Package com.googlecode.objectify.cache
Class AsyncCacheFilter
- java.lang.Object
-
- com.googlecode.objectify.util.AbstractFilter
-
- com.googlecode.objectify.cache.AsyncCacheFilter
-
- All Implemented Interfaces:
javax.servlet.Filter
public class AsyncCacheFilter extends AbstractFilter
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 Future> 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 use the
ObjectifyFilter
.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
-
-
Constructor Summary
Constructors Constructor Description AsyncCacheFilter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
complete()
Perform the actions that are performed upon normal completion of a request.void
doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
-
Methods inherited from class com.googlecode.objectify.util.AbstractFilter
destroy, init
-
-
-
-
Method Detail
-
doFilter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
- Throws:
IOException
javax.servlet.ServletException
-
complete
public static void complete()
Perform the actions that are performed upon normal completion of a request.
-
-