Overview | Package | Class | Tree | Deprecated | Index | Help
| J2EE1.4 SDK
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.appserv.web.cache.filter
Class CachingFilter

    java.lang.Object
      com.sun.appserv.web.cache.filter.CachingFilter

All Implemented Interfaces:
  CacheManagerListener, Filter

public class CachingFilter
extends java.lang.Object
implements Filter, CacheManagerListener

Constructor Summary
`CachingFilter()`

Method Summary
`void` | `cacheManagerDisabled()` cache manager listener method
`void` | `cacheManagerEnabled()` cache manager listener method
`void` | `destroy()` Called by the web container to indicate to a filter that it is being taken out of service.
`void` | `doFilter(ServletRequest srequest, ServletResponse sresponse, FilterChain chain)` The `doFilter` method of the Filter is called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain.
`void` | `init(FilterConfig filterConfig)` Called by the web container to indicate to a filter that it is being placed into service.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CachingFilter

    public CachingFilter()

Method Detail

### init

    public void init(FilterConfig filterConfig)
              throws ServletException

  Called by the web container to indicate to a filter that it is being placed into service. The servlet container calls the init method exactly once after instantiating the filter. The init method must complete successfully before the filter is asked to do any filtering work.

  Specified by:
    `init` in interface `Filter`
  Parameters:
    `filterConfig` - filter config
  Throws:
    `ServletException`

### doFilter

    public void doFilter(ServletRequest srequest,
                         ServletResponse sresponse,
                         FilterChain chain)
                  throws java.io.IOException,
                         ServletException

  The `doFilter` method of the Filter is called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain. The FilterChain passed in to this method allows the Filter to pass on the request and response to the next entity in the chain.

  Specified by:
    `doFilter` in interface `Filter`
  Parameters:
    `chain` - the filter chain to in the request processing
  Throws:
    `IOException,` - ServletException - First check if this HTTP method permits caching (using helper) if not, call the downstream filter and return. - Otherwise, get the key based on the request (using helper). - Check if we have a response entry in the cache already. - If there is entry and is valid, write out the response from that entry. - create a CachingResponse and CachingOutputStream wrappers and call the downstream filter
    `java.io.IOException`
    `ServletException`

### cacheManagerEnabled

    public void cacheManagerEnabled()

  cache manager listener method

  Specified by:
    `cacheManagerEnabled` in interface `CacheManagerListener`

### cacheManagerDisabled

    public void cacheManagerDisabled()

  cache manager listener method

  Specified by:
    `cacheManagerDisabled` in interface `CacheManagerListener`

### destroy

    public void destroy()

  Called by the web container to indicate to a filter that it is being taken out of service. This method is only called once all threads within the filter's doFilter method have exited or after a timeout period has passed. After the web container calls this method, it will not call the doFilter method again on this instance of the filter.

  Specified by:
    `destroy` in interface `Filter`

Overview | Package | Class | Tree | Deprecated | Index | Help
| J2EE1.4 SDK
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature

Copyright 2003 Sun Microsystems, Inc. All rights reserved.