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.
Constructor and Description |
---|
AsyncCacheFilter() |
Modifier and Type | Method and 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) |
destroy, init
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
public static void complete()
Copyright © 2016. All rights reserved.