org.apache.cayenne.conf
Class WebApplicationContextFilter
java.lang.Object
org.apache.cayenne.conf.WebApplicationContextFilter
- All Implemented Interfaces:
- javax.servlet.Filter
public class WebApplicationContextFilter
- extends Object
- implements javax.servlet.Filter
A Servlet Filter that binds session DataContext to the current request thread. During
the request application code without any knowledge of the servlet environment can
access DataContext via DataContext.getThreadDataContext()
method.
To
enable the filter add XML similar to this in the web.xml
descriptor of a
web application:
<filter>
<filter-name>CayenneFilter</filter-name>
<filter-class>org.apache.cayenne.conf.WebApplicationContextFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CayenneFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
- Since:
- 1.2
Method Summary |
void |
destroy()
Cleanup callback method that shuts down shared configuration, specifically
EventManager dispatch threads. |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
The main worker method that binds a DataContext to the current thread on entry and
unbinds it on exit (regardless of whether any exceptions occured in the request). |
void |
init(javax.servlet.FilterConfig filterConfig)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WebApplicationContextFilter
public WebApplicationContextFilter()
init
public void init(javax.servlet.FilterConfig filterConfig)
throws javax.servlet.ServletException
- Specified by:
init
in interface javax.servlet.Filter
- Throws:
javax.servlet.ServletException
destroy
public void destroy()
- Cleanup callback method that shuts down shared configuration, specifically
EventManager dispatch threads.
- Specified by:
destroy
in interface javax.servlet.Filter
doFilter
public void doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
throws IOException,
javax.servlet.ServletException
- The main worker method that binds a DataContext to the current thread on entry and
unbinds it on exit (regardless of whether any exceptions occured in the request).
- Specified by:
doFilter
in interface javax.servlet.Filter
- Throws:
IOException
javax.servlet.ServletException
Copyright © 2001-2011 Apache Cayenne. All Rights Reserved.