com.caucho.filters
Class ExpiresFilter

java.lang.Object
  extended by com.caucho.filters.ExpiresFilter
All Implemented Interfaces:
Filter

public class ExpiresFilter
extends java.lang.Object
implements Filter

Caches the servlet output. ExpiresFilter sets the Expires header to a time in the filter. The page will be cached until that time expires.

The cache-time init-parameter configures how long the page should be cached:

 <filter>
   <filter-name>expires-cache</filter-name>
   <filter-class>com.caucho.http.filter.ExpiresFilter</filter-class>
   <init-param cache-time='10s'/>
 </filter>
 
The cache-time allows the standard extensions:
sseconds
mminutes
hhours
Ddays
Wweeks
Mmonths
Yyears

Since:
Resin 2.0.5

Constructor Summary
ExpiresFilter()
           
 
Method Summary
 void destroy()
          Any cleanup for the filter.
 void doFilter(ServletRequest request, ServletResponse response, FilterChain nextFilter)
          The filter add an Expires time in the future.
 void init(FilterConfig config)
          Filter init reads the filter configuration
 void setCacheTime(Period period)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpiresFilter

public ExpiresFilter()
Method Detail

setCacheTime

public void setCacheTime(Period period)

init

public void init(FilterConfig config)
          throws ServletException
Filter init reads the filter configuration

Specified by:
init in interface Filter
Throws:
ServletException

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain nextFilter)
              throws ServletException,
                     java.io.IOException
The filter add an Expires time in the future.

Specified by:
doFilter in interface Filter
Parameters:
request - the servlet request
response - the servlet response
nextFilter - the next filter in the chain
Throws:
ServletException
java.io.IOException

destroy

public void destroy()
Any cleanup for the filter.

Specified by:
destroy in interface Filter