pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.service
Class IntelliCache

java.lang.Object
  extended by org.torweg.pulse.service.IntelliCache

public final class IntelliCache
extends java.lang.Object

the pulse IntelliCache allows private caching of dynamic pages as long as the ServiceSession associated with the current request is still stateless.

IntelliCache is based upon ETags and can be configured in the ServiceRequest configuration in WEB-INF/conf.

Version:
$Revision$
Author:
Thomas Weber

Method Summary
static void addCachingETag(ServiceRequest request)
          sets an ETag to the underlying HTTP response, if the session has no state and the ETag max age is larger than zero milliseconds.
static boolean validateCachingETag(ServiceRequest request)
          checks whether the current If-None-Match header allows for a 304 Not Modified response and sends it, if appropriate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

validateCachingETag

public static boolean validateCachingETag(ServiceRequest request)
checks whether the current If-None-Match header allows for a 304 Not Modified response and sends it, if appropriate.

Parameters:
request - the current request
Returns:
true, if the a 304 Not Modified response has been sent. Otherwise false.

addCachingETag

public static void addCachingETag(ServiceRequest request)
sets an ETag to the underlying HTTP response, if the session has no state and the ETag max age is larger than zero milliseconds.

The ETag is constructed of Command.getETagValue(), the current system time for validity checking (System.currentTimeMillis()) and the hashcode of the "user-agent" request header.

Parameters:
request - the current request
See Also:
ServiceSession.hasState(), ServiceRequest.getIntelliCacheMaxAge()