org.codehaus.httpcache4j.cache
Class Vary

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

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

Represents a HTTP Variation. We need to store a different version of the response if the request varies on E.G Accept headers. Implementors of storage engines needs to have knowledge of this class. See Key for how it's used.

Author:
Erlend Hamnaberg
See Also:
Serialized Form

Nested Class Summary
static class Vary.VaryComparator
           
 
Constructor Summary
Vary()
          Default constructor (no variations)
Vary(java.util.Map<java.lang.String,java.lang.String> headers)
          Constructor
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.util.Map<java.lang.String,java.lang.String> getVaryHeaders()
           
 int hashCode()
           
 boolean isEmpty()
           
 boolean matches(HTTPRequest request)
          Analyses the headers in the given request to figure out if this variation matches.
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Vary

public Vary()
Default constructor (no variations)


Vary

public Vary(java.util.Map<java.lang.String,java.lang.String> headers)
Constructor

Parameters:
headers - the vary headers as keys from the response, with request headers as values.
Method Detail

size

public int size()

isEmpty

public boolean isEmpty()

matches

public boolean matches(HTTPRequest request)
Analyses the headers in the given request to figure out if this variation matches.

Parameters:
request - the request to analyse
Returns:
true if the request matches the variance. false if not.

toString

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

getVaryHeaders

public java.util.Map<java.lang.String,java.lang.String> getVaryHeaders()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2008-2009. All Rights Reserved.