public class ObjectifyFilter extends AsyncCacheFilter
ObjectifyService
to provide the correct Objectify
instance when ObjectifyService.ofy()
is called.
In your web.xml:
<filter> <filter-name>ObjectifyFilter</filter-name> <filter-class>com.googlecode.objectify.ObjectifyFilter</filter-class> </filter> <filter-mapping> <filter-name>ObjectifyFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>Or, if you use Guice:
filter("/*").through(ObjectifyFilter.class);
If you use the Objectify outside of the context of a request (say, using the remote
API or from a unit test), then you should call ObjectifyFilter.complete()
after every operation
that you consider a "request". For example, after each test.
Constructor and Description |
---|
ObjectifyFilter() |
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
doFilter
in interface javax.servlet.Filter
doFilter
in class AsyncCacheFilter
IOException
javax.servlet.ServletException
public static void complete()
Copyright © 2013. All Rights Reserved.