|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.w3c.tools.resources.AttributeHolder | +--org.w3c.www.protocol.http.cache.CachedResource | +--org.w3c.www.protocol.http.cache.EntityCachedResource
A cached resource with an entity
Field Summary | |
protected static int |
ATTR_CONTENT_TYPE
Attribute index - The Content-Type of the resource |
protected static int |
ATTR_FRESHNESS_LIFETIME
Attribute index - The resource's max age. |
protected static int |
ATTR_INITIAL_AGE
Attribute index - The initial age of this resource. |
protected static int |
ATTR_LOAD_STATE
Attribute index - The download state |
protected static int |
ATTR_RESPONSE_TIME
Attribute index - The response time |
protected static int |
ATTR_REVALIDATE
Attribute index - Revalidate flag |
static int |
COND_FAILED
Condition check return code - Condition existed but failed. |
static int |
COND_OK
Condition check return code - Condition existed and succeeded. |
static int |
COND_WEAK
Condition check return code - Condition existed and succeeded but is a weak validation. |
protected CacheFilter |
filter
|
protected boolean |
hasEntity
|
protected int |
oldsize
|
protected boolean |
regetting
|
protected boolean |
revalidating
|
protected int |
wantedsize
|
Fields inherited from class org.w3c.www.protocol.http.cache.CachedResource |
a,
ATTR_CONNEG_HEADERS,
ATTR_CONTENT_ENCODING,
ATTR_CONTENT_LANGUAGE,
ATTR_CONTENT_LENGTH,
ATTR_CONTENT_MD5,
ATTR_CURRENT_LENGTH,
ATTR_DATE,
ATTR_DESCR,
ATTR_ETAG,
ATTR_EXTRA_HEADERS,
ATTR_FILE,
ATTR_IDENTIFIER,
ATTR_LOAD_STATE,
ATTR_LOCATION,
ATTR_REPLY_LAST_MODIFIED,
ATTR_STATUS,
ATTR_VARY,
COND_FAILED,
COND_OK,
filter,
generation,
invalidated,
NAME_CONTENT_LENGTH,
NAME_CURRENT_LENGTH,
NAME_FILE,
NAME_IDENTIFIER,
next,
prev,
STATE_LOAD_COMPLETE,
STATE_LOAD_ERROR,
STATE_LOAD_PARTIAL,
STATE_LOAD_UNKNOWN,
STATE_NOT_LOADED,
uploading |
Fields inherited from class org.w3c.tools.resources.AttributeHolder |
attributes,
values |
Constructor Summary | |
EntityCachedResource()
|
|
EntityCachedResource(CacheFilter filter,
Request req,
Reply rep)
A constructor for new resources that will get some data directly FIXME params |
Method Summary | |
int |
checkIfMatch(Request request)
Try to validate an If-Match request. |
int |
checkIfModifiedSince(Request request)
Try to validate an If-Modified-Since request. |
int |
checkIfNoneMatch(Request request)
Try to validate an If-None-Match request. |
int |
checkIfUnmodifiedSince(Request request)
Try to validate an If-Unmodified-Since request. |
int |
checkValidators(Request request)
check the validators namely LMT/Etags according to rfc2616 rules |
protected void |
cleanUpload()
|
MimeType |
getContentType()
Get the Content-Type of the cached resource of null if
there is no mime type (it should NEVER happen!) |
int |
getCurrentAge()
Get the current age of this resource |
int |
getFreshnessLifetime()
Get this resource's freshness lifetime (RFC2616: 13.2.4). |
HttpEntityTag |
getHETag()
Get the entity tag associated with that cached entry |
int |
getInitialAge()
Get this cached entry initial age. |
java.io.InputStream |
getInputStream()
Get the cached data for that cached entry. |
long |
getResponseTime()
Get the time of the response used to cached that entry. |
boolean |
getRevalidate()
Get the revalidate flag |
protected Reply |
handleRangeRequest(Request request,
HttpRange r)
handle a range request, according to the first range or the request FIXME we should handle all the ranges at some point... |
void |
initialize(java.lang.Object[] values)
The basic initialization |
void |
notifyTeeFailure(int size)
Called when the Tee stream fails, it allows you to notify a listener of an error in the stream. |
void |
notifyTeeSuccess(int size)
Called when the tee succeed, it allows you to notify a listener of the Tee that the download completed succesfully with a specific size |
Reply |
perform(Request request)
This cached entry has been checked valid, perform given request. |
void |
setContentType(MimeType type)
Set the Content-Type of this cached resource |
void |
setFreshnessLifetime(int freshnessLifetime)
Set this cached entry . |
void |
setInitialAge(int initage)
Set this resource's initial age. |
protected Reply |
setReplyHeaders(Reply reply)
decorate the reply header with some meta information taken from the cached resource |
Request |
setRequestRevalidation(Request request)
This cached entry needs revalidation, it will modify the request to do that. |
void |
setResponseTime(long responsetime)
Set this cached entry response time. |
void |
setRevalidate(boolean validate)
Set this cached entry revalidate flag. |
java.io.InputStream |
tryActiveCacheContent(java.io.InputStream in)
Try using an active stream to cache the content. |
protected void |
updateInfo(Request request,
Reply rep)
sets some useful information about the entity |
protected void |
waitUpload()
FIXME Will be replaced soon, so that multiple people may share the same temporary resource. |
Methods inherited from class org.w3c.www.protocol.http.cache.CachedResource |
delete,
getConnegHeaders,
getContentEncoding,
getContentLanguage,
getContentLength,
getContentMD5,
getCurrentLength,
getDate,
getETag,
getExtraHeaders,
getFile,
getIdentifier,
getLastModified,
getLoadState,
getNext,
getPrev,
getStatus,
getVary,
getWillRevalidate,
lookupResource,
setConnegHeaders,
setContentEncoding,
setContentLanguage,
setContentLength,
setContentMD5,
setCurrentLength,
setDate,
setETag,
setExtraHeaders,
setFile,
setLastModified,
setLoadState,
setNext,
setPrev,
setStatus,
setValue,
setVary,
setWillRevalidate |
Methods inherited from class org.w3c.tools.resources.AttributeHolder |
definesAttribute,
definesAttribute,
getAttributes,
getBoolean,
getChar,
getClone,
getClone,
getClone,
getDouble,
getFloat,
getInt,
getLong,
getString,
getValue,
getValue,
initialize,
lookupAttribute,
pickleValues,
print,
setBoolean,
setChar,
setDouble,
setFloat,
setInt,
setLong,
setString,
setValue,
unsafeGetString,
unsafeGetValue |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int COND_FAILED
public static final int COND_OK
public static final int COND_WEAK
protected static int ATTR_CONTENT_TYPE
protected static int ATTR_FRESHNESS_LIFETIME
protected static int ATTR_INITIAL_AGE
protected static int ATTR_RESPONSE_TIME
protected static int ATTR_REVALIDATE
protected static int ATTR_LOAD_STATE
protected boolean revalidating
protected boolean regetting
protected boolean hasEntity
protected int oldsize
protected int wantedsize
protected CacheFilter filter
Constructor Detail |
public EntityCachedResource(CacheFilter filter, Request req, Reply rep)
public EntityCachedResource()
Method Detail |
public MimeType getContentType()
null
if
there is no mime type (it should NEVER happen!)public void setContentType(MimeType type)
a
- MimeType, the mime type of this resourcepublic int getFreshnessLifetime()
public void setFreshnessLifetime(int freshnessLifetime)
maxage
- A number of seconds during which the entry will
remain valid, or -1 to undefine previous setting.public int getInitialAge()
public void setInitialAge(int initage)
initage
- The initial age as a number of seconds
or -1 to undefine previous setting.public long getResponseTime()
public void setResponseTime(long responsetime)
responsetime
- A long number of milliseconds indicating the
response time relative to Java epoch, or -1 to
undefined previous setting.public boolean getRevalidate()
true
if the proxy must revalidate
stale entries
-1 if undefined.public void setRevalidate(boolean validate)
validate,
- a boolean, true
if this entry needs
to be revalidated while stale.public HttpEntityTag getHETag()
public java.io.InputStream getInputStream() throws java.io.IOException
public int getCurrentAge()
public int checkIfModifiedSince(Request request)
If-Modified-Since
request.request
- The request to validate.COND_FAILED
, if the condition was
checked, but failed; COND_OK
of condition was checked
and succeeded, 0 otherwise.public int checkIfUnmodifiedSince(Request request)
If-Unmodified-Since
request.request
- The request to validate.COND_FAILED
, if the condition was
checked, but failed; COND_OK
of condition was checked
and succeeded, 0 otherwise.public int checkIfMatch(Request request)
If-Match
request.request
- The request to validate.COND_FAILED
, if the condition was
checked, but failed; COND_OK
of condition was checked
and succeeded, 0 otherwise.public int checkIfNoneMatch(Request request)
If-None-Match
request.request
- The request to validate.COND_FAILED
, if the condition was
checked, but failed; COND_OK
of condition was checked
and succeeded, 0 otherwise.public void notifyTeeSuccess(int size)
public void notifyTeeFailure(int size)
protected void cleanUpload()
protected final void waitUpload()
protected Reply handleRangeRequest(Request request, HttpRange r)
protected Reply setReplyHeaders(Reply reply)
public int checkValidators(Request request)
COND_FAILED if condition
was checked, but failed, COND_OK
if condition was checked
and succeeded, or 0 if the condition was not checked
at all (eg because the resource or the request didn't support it).
public Reply perform(Request request) throws HttpException
request
- The request to perform.public java.io.InputStream tryActiveCacheContent(java.io.InputStream in) throws java.io.IOException
public void initialize(java.lang.Object[] values)
values
- The attribute values the holder should initialize from.protected void updateInfo(Request request, Reply rep)
the
- request that requested this entitythe
- reply triggered by this requestpublic Request setRequestRevalidation(Request request)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |