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.request
Enum CacheMode

java.lang.Object
  extended by java.lang.Enum<CacheMode>
      extended by org.torweg.pulse.service.request.CacheMode
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<CacheMode>

public enum CacheMode
extends java.lang.Enum<CacheMode>

sets the cache level for a response sent back via HTTP.

Version:
$Revision: 1879 $
Author:
Thomas Weber
See Also:
setResponseHeaders(HttpServletResponse), setResponseHeaders(ServiceRequest)

Enum Constant Summary
INTELLICACHE
          used in conjunction with IntelliCache; allows private caching, forces contents to be checked for changes upon each request.
NONE
          disallow caching.
PRIVATE
          allow caching in the browser (default max-age set to 1 day).
PUBLIC
          allow caching by both browsers and proxies (default max-age set to 1 day).
 
Method Summary
 int getMaxAgeInSeconds()
          returns the max-age in seconds for the cached item to be valid.
abstract  void setResponseHeaders(javax.servlet.http.HttpServletResponse response)
          adds the response headers for the CacheMode.
 void setResponseHeaders(ServiceRequest request)
          adds the response headers for the CacheMode.
static CacheMode valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static CacheMode[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NONE

public static final CacheMode NONE
disallow caching.

Cache-Control: private, no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0
Pragma: no-cache


INTELLICACHE

public static final CacheMode INTELLICACHE
used in conjunction with IntelliCache; allows private caching, forces contents to be checked for changes upon each request.

Cache-Control: private, must-revalidate, post-check=0, pre-check=0


PRIVATE

public static final CacheMode PRIVATE
allow caching in the browser (default max-age set to 1 day).

Cache-Control: private, max-age={given max-age}, post-check={2/3 of given max-age}, pre-check={given max-age}


PUBLIC

public static final CacheMode PUBLIC
allow caching by both browsers and proxies (default max-age set to 1 day).

Cache-Control: public, max-age={given max-age}

Method Detail

values

public static final CacheMode[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(CacheMode c : CacheMode.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static CacheMode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name

getMaxAgeInSeconds

public final int getMaxAgeInSeconds()
returns the max-age in seconds for the cached item to be valid.

Returns:
the max-age in seconds for the cached item to be valid

setResponseHeaders

public final void setResponseHeaders(ServiceRequest request)
adds the response headers for the CacheMode.

Parameters:
request - the current ServiceRequest

setResponseHeaders

public abstract void setResponseHeaders(javax.servlet.http.HttpServletResponse response)
adds the response headers for the CacheMode.

This method is implemented by the individual Enum values.

Parameters:
response - the HttpServletResponse