|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.www.protocol.http.cache.CacheFilter
public class CacheFilter
Field Summary | |
---|---|
static java.lang.String |
CACHE_CONNECTED_P
Name of the property enabling the connected/disconnected mode |
static java.lang.String |
CACHE_SIZE_P
The name of the properties indicating the size of the cache (in bytes). |
protected boolean |
connected
|
protected boolean |
debug
|
static java.lang.String |
DEBUG_P
Name of the property indicating if the cache is in debug mode. |
protected java.io.File |
directory
|
protected java.util.Hashtable |
precache
|
protected ObservableProperties |
props
The properties we initialized ourself from. |
protected CacheSerializer |
serializer
|
static java.lang.String |
SERIALIZER_P
|
protected boolean |
shared
|
static java.lang.String |
SHARED_P
Name of the property indicating if this cache is shared. |
protected long |
size
|
static java.lang.String |
STATE_NOCACHE
The state used to disable that filter per request. |
static java.lang.String |
STATE_ORIGREQ
Name of the request state used tokeep track of original request |
static java.lang.String |
STATE_REVALIDATION
Name of the request state that marks a request as being a revalidation. |
static java.lang.String |
STATE_WARNINGS
Name of the request state used to collect warnings. |
protected CacheStore |
store
|
protected CacheSweeper |
sweeper
|
static java.lang.String |
SWEEPER_P
|
protected java.util.Hashtable |
uritable
|
protected CacheValidator |
validator
|
static java.lang.String |
VALIDATOR_P
|
protected static HttpWarning |
WARN_DISCONNECTED
The HTTP warning used to notify of a disconnected cache. |
protected static HttpWarning |
WARN_HEURISTIC
The HTTP warning used to indicate a heuristic expiration time. |
protected static HttpWarning |
WARN_STALE
The HTTP warning used to mark invalid entries |
Constructor Summary | |
---|---|
CacheFilter()
|
Method Summary | |
---|---|
protected void |
addWarning(Request request,
HttpWarning warning)
Add a warning, to be emitted at reply time. |
boolean |
canCache(Request req,
Reply rep)
Checks if, according to the headers of the reply, an entity may be cached or not, it decorates also the reply |
boolean |
canStore(Request req,
Reply rep)
Checks if, according to the headers of a reply we can store the resource. |
boolean |
canUseCache(Request req)
check if we can use the cache or not for this request It marks the request as being not cachable if false. |
protected void |
cleanUpload(CachedResource cr)
do what is needed when an upload is done! ie: remove from the precache and put in the store |
boolean |
exceptionFilter(Request request,
HttpException ex)
This filter handle exceptions. |
CacheSerializer |
getSerializer()
return the serializer used by the cache |
CacheStore |
getStore()
|
CacheSweeper |
getSweeper()
return the cache sweeper used by the cache |
CacheValidator |
getValidator()
return the cache validator used by the cache |
Reply |
ingoingFilter(Request request)
The request pre-processing hook. |
void |
initialize(HttpManager manager)
Initialize this filter, using the provided manager. |
boolean |
isConnected()
is the cache connected? |
boolean |
isShared()
is the cache shared? |
Reply |
outgoingFilter(Request request,
Reply reply)
The request post-processing hook. |
boolean |
propertyChanged(java.lang.String name)
Property monitoring for the CacheFilter. |
void |
pushDocument(Request request,
Reply reply)
Push a document in the cache. |
protected Request |
setRequestRevalidation(CachedResource res,
Request req)
Modify a request to ask for a revalidation |
protected void |
setWarnings(Request request,
Reply reply)
Copy all warnings colllected into the given reply. |
void |
sync()
Synchronized any pending state into stable storage. |
protected void |
trace(Request request,
java.lang.String msg)
Display some output, related to the request (used for debugging) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SERIALIZER_P
public static final java.lang.String SWEEPER_P
public static final java.lang.String VALIDATOR_P
public static final java.lang.String CACHE_CONNECTED_P
public static final java.lang.String SHARED_P
This property defaults to true.
public static final java.lang.String CACHE_SIZE_P
This property defaults to 5000000 bytes.
public static final java.lang.String DEBUG_P
This property defaults to false.
public static final java.lang.String STATE_NOCACHE
public static final java.lang.String STATE_WARNINGS
public static final java.lang.String STATE_ORIGREQ
public static final java.lang.String STATE_REVALIDATION
protected static HttpWarning WARN_DISCONNECTED
protected static HttpWarning WARN_STALE
protected static HttpWarning WARN_HEURISTIC
protected ObservableProperties props
protected CacheValidator validator
protected CacheStore store
protected CacheSweeper sweeper
protected CacheSerializer serializer
protected boolean connected
protected boolean shared
protected long size
protected java.io.File directory
protected boolean debug
protected java.util.Hashtable precache
protected java.util.Hashtable uritable
Constructor Detail |
---|
public CacheFilter()
Method Detail |
---|
public CacheSweeper getSweeper()
public CacheSerializer getSerializer()
public CacheValidator getValidator()
public boolean isShared()
public boolean isConnected()
protected final void trace(Request request, java.lang.String msg)
protected void addWarning(Request request, HttpWarning warning)
During request processing, cached resources can add any kind of warnings, which will be collected and forwarded back to the reply.
request
- The request being process, and whose reply requires
some warnings.warning
- The warning to be emitted if ever we use the cache
filter to answer the above request.protected final void setWarnings(Request request, Reply reply)
request
- The request that has been processed by the cache filter.reply
- The reply that has been constructed from the cache.addWarning(org.w3c.www.protocol.http.Request, org.w3c.www.http.HttpWarning)
public boolean canUseCache(Request req)
a
- request, the incoming client-side request
public boolean canCache(Request req, Reply rep)
a
- request, the client side requesta
- reply, the client side reply
public boolean canStore(Request req, Reply rep)
a
- request, the client side requesta
- reply, the client side reply
protected Request setRequestRevalidation(CachedResource res, Request req)
the
- resource to be revalidatedrequest,
- the original request to be modifiedpublic Reply ingoingFilter(Request request) throws HttpException
ingoingFilter
in interface RequestFilter
request
- The request that is about to be launched.
HttpException
- If the filter is supposed to fulfill the
request, but some error happened during that processing.public boolean exceptionFilter(Request request, HttpException ex)
exceptionFilter
in interface RequestFilter
request
- The request that triggered the exception.ex
- The triggered exception.
public Reply outgoingFilter(Request request, Reply reply) throws HttpException
It gets the original request, and the actual reply as a parameter, and should return whatever reply it wants the caller to get.
outgoingFilter
in interface RequestFilter
request
- The original (handled) request.reply
- The reply, as emited by the target server, or constructed
by some other filter.
HttpException
- If the reply emitted by the server is not
a valid HTTP reply.public void sync()
RequestFilter
sync
in interface RequestFilter
public boolean propertyChanged(java.lang.String name)
propertyChanged
in interface PropertyMonitoring
name
- The name of the property that has changed.
public void pushDocument(Request request, Reply reply)
It is recommended that the reply provides at least the following informations:
protected void cleanUpload(CachedResource cr)
the
- CachedResource to be moved.public CacheStore getStore()
public void initialize(HttpManager manager) throws PropRequestFilterException
PropRequestFilter
setFilter
method.
initialize
in interface PropRequestFilter
manager
- The HttpManager initializing the filter.
PropRequestFilterException
- If the filter couldn't be
initialized properly.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |