org.codehaus.httpcache4j
Class Tag

java.lang.Object
  extended by org.codehaus.httpcache4j.Tag
All Implemented Interfaces:
java.io.Serializable

public final class Tag
extends java.lang.Object
implements java.io.Serializable

Validation tag equivalent to the HTTP entity tag. "A strong entity tag may be shared by two entities of a resource only if they are equivalent by octet equality.
A weak entity tag may be shared by two entities of a resource only if the entities are equivalent and could be substituted for each other with no significant change in semantics."

See Also:
HTTP Entity Tags, HTTP Entity Tag Cache Validators, Serialized Form

Field Summary
static Tag ALL
          Tag matching any other tag, used in call's condition data.
 
Constructor Summary
Tag(java.lang.String opaqueTag)
          Constructor.
Tag(java.lang.String opaqueTag, boolean weak)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object object)
          Indicates if both tags are equal.
 boolean equals(java.lang.Object object, boolean checkWeakness)
          Indicates if both tags are equal.
 java.lang.String format()
          Returns tag formatted as an HTTP tag string.
 java.lang.String getDescription()
          Returns the description.
 java.lang.String getName()
          Returns the name, corresponding to an HTTP opaque tag value.
 int hashCode()
          
 boolean isWeak()
          Indicates if the tag is weak.
static Tag parse(java.lang.String httpTag)
          Parses a tag formatted as defined by the HTTP standard.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ALL

public static final Tag ALL
Tag matching any other tag, used in call's condition data.

Constructor Detail

Tag

public Tag(java.lang.String opaqueTag,
           boolean weak)
Constructor.

Parameters:
opaqueTag - The tag value.
weak - The weakness indicator.

Tag

public Tag(java.lang.String opaqueTag)
Constructor.

Parameters:
opaqueTag - The tag value.
Method Detail

parse

public static Tag parse(java.lang.String httpTag)
Parses a tag formatted as defined by the HTTP standard.

Parameters:
httpTag - The HTTP tag string; if it starts with 'W/' the tag will be marked as weak and the data following the 'W/' used as the tag; otherwise it should be surrounded with quotes (e.g., "sometag").
Returns:
A new tag instance.
See Also:
HTTP Entity Tags

equals

public boolean equals(java.lang.Object object)
Indicates if both tags are equal.

Overrides:
equals in class java.lang.Object
Parameters:
object - The object to compare to.
Returns:
True if both tags are equal.

equals

public boolean equals(java.lang.Object object,
                      boolean checkWeakness)
Indicates if both tags are equal.

Parameters:
object - The object to compare to.
checkWeakness - the equality test takes care or not of the weakness.
Returns:
True if both tags are equal.

format

public java.lang.String format()
Returns tag formatted as an HTTP tag string.

Returns:
The formatted HTTP tag string.
See Also:
HTTP Entity Tags

getDescription

public java.lang.String getDescription()
Returns the description.

Returns:
The description.

getName

public java.lang.String getName()
Returns the name, corresponding to an HTTP opaque tag value.

Returns:
The name, corresponding to an HTTP opaque tag value.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

isWeak

public boolean isWeak()
Indicates if the tag is weak.

Returns:
True if the tag is weak, false if the tag is strong.


Copyright © 2008-2009. All Rights Reserved.