Package com.googlecode.objectify.cache
Class AsyncCacheFilter
java.lang.Object
com.googlecode.objectify.cache.AsyncCacheFilter
- All Implemented Interfaces:
javax.servlet.Filter
This Filter is a companion to the CachingAsyncDatastoreService, and must be installed any time the CachingAsyncDatastoreService is used without Objectify.
This Filter is a temporary measure until Google provides a hook that lets us intercept the raw Futureinvalid input: '<'?> calls at the end of a request. At that point this filter can be eliminated in favor of the hook.
In your web.xml:<filter> <filter-name>AsyncCacheFilter</filter-name> <filter-class>com.googlecode.objectify.cache.AsyncCacheFilter</filter-class> </filter> <filter-mapping> <filter-name>AsyncCacheFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>Or, if you use Guice:
filter("/*").through(AsyncCacheFilter.class);
Note that you do not need to configure this filter if you are using Objectify.
If you use the CachingAsyncDatastoreService outside of the context of a request (say, using the remote
API or from a unit test), then you should call AsyncCacheFilter.complete()
after every operation
that you consider a "request". For example, after each test.
- Author:
- Jeff Schnitzer invalid input: '<'[email protected]>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
complete()
Perform the actions that are performed upon normal completion of a request.void
destroy()
void
doFilter
(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) void
init
(javax.servlet.FilterConfig filterConfig)
-
Constructor Details
-
AsyncCacheFilter
public AsyncCacheFilter()
-
-
Method Details
-
doFilter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException - Specified by:
doFilter
in interfacejavax.servlet.Filter
- Throws:
IOException
javax.servlet.ServletException
-
complete
public static void complete()Perform the actions that are performed upon normal completion of a request. -
init
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException - Specified by:
init
in interfacejavax.servlet.Filter
- Throws:
javax.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroy
in interfacejavax.servlet.Filter
-