Java EE 5 SDK

com.sun.appserv.web.cache
Interface CacheHelper

All Known Implementing Classes:
DefaultCacheHelper

public interface CacheHelper

CacheHelper interface is an user-extensible interface to customize: a) the key generation b) whether to cache the response.


Field Summary
static String ATTR_CACHE_MAPPED_SERVLET_NAME
           
static String ATTR_CACHE_MAPPED_URL_PATTERN
           
static int TIMEOUT_VALUE_NOT_SET
           
 
Method Summary
 void destroy()
          Stop the helper from active use
 String getCacheKey(HttpServletRequest request)
          getCacheKey: generate the key to be used to cache this request
 int getTimeout(HttpServletRequest request)
          get timeout for the cached response.
 void init(ServletContext context, Map props)
          initialize the helper
 boolean isCacheable(HttpServletRequest request)
          isCacheable: is the response to given request cachebale?
 boolean isRefreshNeeded(HttpServletRequest request)
          isRefreshNeeded: is the response to given request be refreshed?
 

Field Detail

ATTR_CACHE_MAPPED_SERVLET_NAME

static final String ATTR_CACHE_MAPPED_SERVLET_NAME
See Also:
Constant Field Values

ATTR_CACHE_MAPPED_URL_PATTERN

static final String ATTR_CACHE_MAPPED_URL_PATTERN
See Also:
Constant Field Values

TIMEOUT_VALUE_NOT_SET

static final int TIMEOUT_VALUE_NOT_SET
See Also:
Constant Field Values
Method Detail

init

void init(ServletContext context,
          Map props)
          throws Exception
initialize the helper

Parameters:
context - the web application context this helper belongs to
Throws:
Exception - if a startup error occurs

getCacheKey

String getCacheKey(HttpServletRequest request)
getCacheKey: generate the key to be used to cache this request

Parameters:
request - incoming HttpServletRequest object
Returns:
the generated key for this requested cacheable resource.

isCacheable

boolean isCacheable(HttpServletRequest request)
isCacheable: is the response to given request cachebale?

Parameters:
request - incoming HttpServletRequest object
Returns:
true if the response could be cached. or false if the results of this request must not be cached.

isRefreshNeeded

boolean isRefreshNeeded(HttpServletRequest request)
isRefreshNeeded: is the response to given request be refreshed?

Parameters:
request - incoming HttpServletRequest object
Returns:
true if the response needs to be refreshed. or return false if the results of this request don't need to be refreshed.

getTimeout

int getTimeout(HttpServletRequest request)
get timeout for the cached response.

Parameters:
request - incoming HttpServletRequest object
Returns:
the timeout in seconds for the cached response; a return value of -1 means the response never expires and a value of -2 indicates helper cannot determine the timeout (container assigns default timeout)

destroy

void destroy()
             throws Exception
Stop the helper from active use

Throws:
Exception - if an error occurs

Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.