org.codehaus.httpcache4j.cache
Class Vary

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

public final class Vary
extends Object
implements ToJSON

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

Nested Class Summary
static class Vary.VaryComparator
           
 
Constructor Summary
Vary()
          Default constructor (no variations)
Vary(Headers headers)
           
Vary(Map<String,String> headers)
          Constructor
 
Method Summary
 boolean equals(Object o)
           
static Vary fromJSON(String value)
           
 Map<String,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()
           
 String toJSON()
           
 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(Map<String,String> headers)
Constructor

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

Vary

public Vary(Headers headers)
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 String toString()
Overrides:
toString in class Object

getVaryHeaders

public Map<String,String> getVaryHeaders()

fromJSON

public static Vary fromJSON(String value)

toJSON

public String toJSON()
Specified by:
toJSON in interface ToJSON

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2008-2011. All Rights Reserved.