Package com.googlecode.objectify
Class ObjectifyService.Filter
java.lang.Object
com.googlecode.objectify.ObjectifyService.Filter
- All Implemented Interfaces:
jakarta.servlet.Filter
- Enclosing class:
ObjectifyService
This version is for the newer jakarta.servlet.* API. If you are using the older javax.servlet.*, use FilterJavax
.
Configure this filter to use Objectify in your application. It works in concert with 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.ObjectifyService$Filter</filter-class> </filter> <filter-mapping> <filter-name>ObjectifyFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
Or, if you use Guice:
filter("/*").through(ObjectifyService.Filter.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 use the ObjectifyService.run() method.
- Author:
- Jeff Schnitzer
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
Filter
public Filter()
-
-
Method Details
-
doFilter
public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException - Specified by:
doFilter
in interfacejakarta.servlet.Filter
- Throws:
IOException
jakarta.servlet.ServletException
-
init
public void init(jakarta.servlet.FilterConfig filterConfig) throws jakarta.servlet.ServletException - Specified by:
init
in interfacejakarta.servlet.Filter
- Throws:
jakarta.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroy
in interfacejakarta.servlet.Filter
-