org.w3c.www.protocol.http.cache
Class VaryResource

java.lang.Object
  |
  +--org.w3c.tools.resources.AttributeHolder
        |
        +--org.w3c.tools.resources.Resource
              |
              +--org.w3c.www.protocol.http.cache.CachedResource
                    |
                    +--org.w3c.www.protocol.http.cache.VaryResource

public class VaryResource
extends CachedResource


Field Summary
protected static int ATTR_VARIANT_LOCATIONS
          Attribute index - The location of the variants.
protected static int ATTR_VARY
          Attribute index - The dimension on which this resource varies.
protected  CachedResource[] variants
          The loaded list of cached variants.
 
Fields inherited from class org.w3c.www.protocol.http.cache.CachedResource
ATTR_CACHE_FILTER, ATTR_CONTENT_LENGTH, ATTR_CONTENT_TYPE, ATTR_DATE, ATTR_ETAG, ATTR_EXTRA_HEADERS, ATTR_FILE, ATTR_GENERATION, ATTR_INITAGE, ATTR_MAXAGE, ATTR_REPLY_LAST_MODIFIED, ATTR_RESOURCE_STORE, ATTR_RESPONSE_TIME, ATTR_REVALIDATE, ATTR_STATUS, COND_FAILED, COND_OK, DEFAULT_MAXAGE
 
Fields inherited from class org.w3c.tools.resources.Resource
ATTR_CONTEXT, ATTR_HELP_URL, ATTR_IDENTIFIER, ATTR_LAST_MODIFIED, ATTR_PARENT, ATTR_RESOURCE_FRAMES, ATTR_STORE_ENTRY, ATTR_URL
 
Fields inherited from class org.w3c.tools.resources.AttributeHolder
attributes, slowpickle, values
 
Constructor Summary
VaryResource()
           
 
Method Summary
 void addVariant(CachedResource v)
           
 void delete()
          Delete this cached entry from the cache.
 CachedResource getVariant(HttpEntityTag etag)
           
 java.lang.String[] getVariantLocations()
          Get this varying resource cached variant locations.
 CachedResource[] getVariants()
           
 HttpEntityTag[] getVariantsETag()
           
 java.lang.String[] getVary()
          Get the dimension on which this resource varies.
 boolean isValid(Request request)
          Is the currently cached version usable to answer the given request ?
 void setRequestValidation(Request request)
          Update an original request for a revalidation.
 Reply updateVariant(Request request, Reply reply)
           
 Reply validate(Request request, Reply reply)
          Given an HTTP transaction, validate that cached entry.
 
Methods inherited from class org.w3c.www.protocol.http.cache.CachedResource
cacheContent, checkIfMatch, checkIfModifiedSince, checkIfNoneMatch, checkIfUnmodifiedSince, cleanUpload, computeCurrentAge, getContentLength, getContentType, getDate, getETag, getExtraHeaders, getFile, getGeneration, getHETag, getInitialAge, getInputStream, getLastModified, getMaxAge, getResourceStore, getResponseTime, getRevalidate, getStatus, getWillRevalidate, handleRangeRequest, initialize, initialize, isShared, notifyTeeFailure, notifyTeeSuccess, notifyUploading, perform, setContentLength, setContentType, setDate, setDefaultMaxAge, setETag, setExtraHeaders, setFile, setGeneration, setInitialAge, setLastModified, setMaxAge, setReplyHeaders, setResourceHeaders, setResponseTime, setRevalidate, setStatus, setValue, setWillRevalidate, tryActiveCacheContent, updateAges, waitUpload
 
Methods inherited from class org.w3c.tools.resources.Resource
acceptUnload, checkMultipleLock, collectFrames, getClone, getContext, getFrame, getFrames, getHelpURL, getHelpURL, getIdentifier, getParent, getResourceReference, getServer, getSpace, getSpaceEntry, getStoreEntry, getURLPath, getValue, getValue, isInitialized, isUnloaded, markModified, notifyUnload, registerFrame, setContext, setContext, setValue, unregisterFrame, updateAttributes
 
Methods inherited from class org.w3c.tools.resources.AttributeHolder
definesAttribute, definesAttribute, getAttributes, getBoolean, getChar, getClone, getClone, getDouble, getFloat, getInt, getLong, getString, getValue, initialize, lookupAttribute, pickle, print, setBoolean, setChar, setDouble, setFloat, setInt, setLong, setString, setValue, unpickle, unpickle, unpickle, unpickleInstance, unpickleInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_VARIANT_LOCATIONS

protected static int ATTR_VARIANT_LOCATIONS
Attribute index - The location of the variants.

ATTR_VARY

protected static int ATTR_VARY
Attribute index - The dimension on which this resource varies.

variants

protected CachedResource[] variants
The loaded list of cached variants.
Constructor Detail

VaryResource

public VaryResource()
Method Detail

getVariantLocations

public java.lang.String[] getVariantLocations()
Get this varying resource cached variant locations.
Returns:
A array of URL encoded as String a String array, or null if no variants have been cached yet.

getVary

public java.lang.String[] getVary()
Get the dimension on which this resource varies.
Returns:
A list of HTTP header field names. This method will never return null since this would prevent it from being cached.

addVariant

public void addVariant(CachedResource v)

getVariants

public CachedResource[] getVariants()

getVariantsETag

public HttpEntityTag[] getVariantsETag()

getVariant

public CachedResource getVariant(HttpEntityTag etag)

updateVariant

public Reply updateVariant(Request request,
                           Reply reply)
                    throws java.io.IOException

setRequestValidation

public void setRequestValidation(Request request)
Description copied from class: CachedResource
Update an original request for a revalidation. This method updates the original request to use as much conditionals as possible.
Overrides:
setRequestValidation in class CachedResource
Tags copied from class: CachedResource
Parameters:
request - The request to update.

isValid

public boolean isValid(Request request)
Description copied from class: CachedResource
Is the currently cached version usable to answer the given request ?
Overrides:
isValid in class CachedResource
Tags copied from class: CachedResource
Returns:
A boolean, true if we are able to generate a valid answer to this request by the perform method, false otherwise (the resource needs to be refreshed).

validate

public Reply validate(Request request,
                      Reply reply)
               throws java.io.IOException
Description copied from class: CachedResource
Given an HTTP transaction, validate that cached entry.
Overrides:
validate in class CachedResource
Tags copied from class: CachedResource
Parameters:
request - The request that we used to validate.
reply - The origin's server reply.
Returns:
A reply instance suitable to emit back to the client.

delete

public void delete()
Delete this cached entry from the cache.
Overrides:
delete in class CachedResource
Tags copied from class: Resource
Throws:
MultipleLockException - if someone else has locked this resource