org.w3c.www.protocol.http.cache.push
Class PushCacheFilter

java.lang.Object
  extended by org.w3c.www.protocol.http.cache.CacheFilter
      extended by org.w3c.www.protocol.http.cache.push.PushCacheFilter
All Implemented Interfaces:
PropertyMonitoring, PropRequestFilter, RequestFilter

public class PushCacheFilter
extends CacheFilter

PushCacheFilter Based heavily on (much code stolen from) CacheFilter The important differences are in the initialization where the PushCacheListener is started, and in ingoingFilter where if the requested resource is present in the cache and is a PUSH resource, then the resource is returned immediately without checking for expiry etc. This allows us to insert pages from "virtual" web sites such as http://www.push.data/sensor1.html


Field Summary
static int DEFAULT_PORT_NUM
          Default port number to use if property value is not supplied value is 9876
static java.lang.String PORT_NUM_P
          Property name used to acquire port number for PushCacheListener value is "org.w3c.www.protocol.http.cache.push.portnumber";
 
Fields inherited from class org.w3c.www.protocol.http.cache.CacheFilter
CACHE_CONNECTED_P, CACHE_SIZE_P, connected, debug, DEBUG_P, directory, precache, props, serializer, SERIALIZER_P, shared, SHARED_P, size, STATE_NOCACHE, STATE_ORIGREQ, STATE_REVALIDATION, STATE_WARNINGS, store, sweeper, SWEEPER_P, uritable, validator, VALIDATOR_P, WARN_DISCONNECTED, WARN_HEURISTIC, WARN_STALE
 
Constructor Summary
PushCacheFilter()
           
 
Method Summary
 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.
 org.w3c.www.protocol.http.cache.push.PushCacheStore getPushCacheStore()
          Access to PushCacheStore
 Reply ingoingFilter(Request request)
          The request pre-processing hook.
 void initialize(HttpManager manager)
          Almost identical to CacheFilter.initialize, but creates a PushCacheStore instead of a CacheStore and additionaly starts the PushCacheListener
 
Methods inherited from class org.w3c.www.protocol.http.cache.CacheFilter
addWarning, canCache, canStore, cleanUpload, exceptionFilter, getSerializer, getStore, getSweeper, getValidator, isConnected, isShared, outgoingFilter, propertyChanged, pushDocument, setRequestRevalidation, setWarnings, sync, trace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PORT_NUM_P

public static final java.lang.String PORT_NUM_P
Property name used to acquire port number for PushCacheListener value is "org.w3c.www.protocol.http.cache.push.portnumber";

See Also:
Constant Field Values

DEFAULT_PORT_NUM

public static final int DEFAULT_PORT_NUM
Default port number to use if property value is not supplied value is 9876

See Also:
Constant Field Values
Constructor Detail

PushCacheFilter

public PushCacheFilter()
Method Detail

getPushCacheStore

public org.w3c.www.protocol.http.cache.push.PushCacheStore getPushCacheStore()
Access to PushCacheStore


canUseCache

public 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.

Overrides:
canUseCache in class CacheFilter
Parameters:
a - request, the incoming client-side request
Returns:
a boolean, true if we can use the cache

ingoingFilter

public Reply ingoingFilter(Request request)
                    throws HttpException
The request pre-processing hook. Before each request is launched, all filters will be called back through this method. They will generally set up additional request header fields to enhance the request.

Specified by:
ingoingFilter in interface RequestFilter
Overrides:
ingoingFilter in class CacheFilter
Parameters:
request - The request that is about to be launched.
Returns:
An instance of Reply if the filter could handle the request, or null if processing should continue normally.
Throws:
HttpException - If the filter is supposed to fulfill the request, but some error happened during that processing.

initialize

public void initialize(HttpManager manager)
                throws PropRequestFilterException
Almost identical to CacheFilter.initialize, but creates a PushCacheStore instead of a CacheStore and additionaly starts the PushCacheListener

Specified by:
initialize in interface PropRequestFilter
Overrides:
initialize in class CacheFilter
Parameters:
manager - The HttpManager initializing the filter.
Throws:
PropRequestFilterException - If the filter couldn't be initialized properly.