rabbit.proxy
Class ETagUtils

java.lang.Object
  extended by rabbit.proxy.ETagUtils

public class ETagUtils
extends Object

Methods dealing with etags

Author:
Robert Olofsson

Constructor Summary
ETagUtils()
           
 
Method Summary
static boolean checkStrongEtag(String et, String im)
          Check if we have a strong etag match.
static boolean checkWeakEtag(HttpHeader h1, HttpHeader h2)
          Remove any W/ prefix then check if etags are equal.
static boolean checkWeakEtag(String et, String im)
          Remove any W/ prefix from the inputs then check if they are equal.
static boolean isWeak(String t)
          Check if the given etag is weak.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ETagUtils

public ETagUtils()
Method Detail

isWeak

public static boolean isWeak(String t)
Check if the given etag is weak.

Parameters:
t - the String to check
Returns:
true if the given token starts with the weak identifier "W/"

checkStrongEtag

public static boolean checkStrongEtag(String et,
                                      String im)
Check if we have a strong etag match.

Parameters:
et - the current etag
im - the if-modified tag
Returns:
true if we have a strong matching

checkWeakEtag

public static boolean checkWeakEtag(HttpHeader h1,
                                    HttpHeader h2)
Remove any W/ prefix then check if etags are equal. Inputs can be in any order.

Parameters:
h1 - the first header to get an etag from
h2 - the second header to get an etag from
Returns:
true if the etags match or at least one of the etag headers do not exist.

checkWeakEtag

public static boolean checkWeakEtag(String et,
                                    String im)
Remove any W/ prefix from the inputs then check if they are equal. Inputs can be in any order.

Parameters:
et - an etag header
im - an if-modified header
Returns:
true if equal.