GWT Tk 0.2.3

asquare.gwt.tk.server
Class GWTCacheFilter

java.lang.Object
  extended by asquare.gwt.tk.server.GWTCacheFilter
All Implemented Interfaces:
Filter

public class GWTCacheFilter
extends Object
implements Filter

This is a filter which enforces proper caching of the generated GWT script files. It requires that serve your GWT application via a Java servlet container.

To use, add the jar to WEB-INF/lib and add the following to your deployment descriptor (web.xml):

 <filter>
   <filter-name>GWTCacheFilter</filter-name>
   <filter-class>asquare.gwt.tk.server.GWTCacheFilter</filter-class>
   <description>Enforces proper caching of GWT script files</description>
 </filter>
 
 <filter-mapping>
   <filter-name>GWTCacheFilter</filter-name>
   <url-pattern>*.html</url-pattern>
 </filter-mapping>
By default, files ending in .cache.html are cached and files ending in .nocache.html are not cached. You can override the defaults by specifying file name patterns in filter init-params. The pattern is parsed as a JDK regular expression. The defaults are below:
 <init-param>
   <param-name>forceDontCache</param-name>
   <param-value>.+\.nocache.html</param-value>
 </init-param>
 <init-param>
   <param-name>forceCache</param-name>
   <param-value>.+\.cache.html</param-value>
 </init-param>

Usage notes

See Also:
Cache-control directive, Expires directive, Pragma directive

Field Summary
static String DEFAULT_FORCECACHE
          The default value of the forceDontCache init-param.
static String DEFAULT_FORCEDONTCACHE
          The default value of the forceCache init-param.
static String INITPARAM_FORCECACHE
          The name of the filter init-param which specifies files to cache.
static String INITPARAM_FORCEDONTCACHE
          The name of the filter init-param which specifies files not to cache.
 
Constructor Summary
GWTCacheFilter()
           
 
Method Summary
 void destroy()
           
 void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
           
 void init(FilterConfig filterConfig)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITPARAM_FORCEDONTCACHE

public static final String INITPARAM_FORCEDONTCACHE
The name of the filter init-param which specifies files not to cache. The name is "forceDontCache".

See Also:
Constant Field Values

INITPARAM_FORCECACHE

public static final String INITPARAM_FORCECACHE
The name of the filter init-param which specifies files to cache. The name is "forceCache".

See Also:
Constant Field Values

DEFAULT_FORCEDONTCACHE

public static final String DEFAULT_FORCEDONTCACHE
The default value of the forceCache init-param. The value is ".+\\.nocache.html".

See Also:
Constant Field Values

DEFAULT_FORCECACHE

public static final String DEFAULT_FORCECACHE
The default value of the forceDontCache init-param. The value is ".+\\.cache.html".

See Also:
Constant Field Values
Constructor Detail

GWTCacheFilter

public GWTCacheFilter()
Method Detail

init

public void init(FilterConfig filterConfig)
          throws ServletException
Specified by:
init in interface Filter
Throws:
ServletException

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain chain)
              throws IOException,
                     ServletException
Specified by:
doFilter in interface Filter
Throws:
IOException
ServletException

destroy

public void destroy()
Specified by:
destroy in interface Filter

GWT Tk 0.2.3

© 2007 Mat Gessel