Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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

Constructor Summary
`WebApplicationContextFilter()`

Method Summary
`void` | `destroy()` Cleanup callback method that does nothing, as the filter doesn't store any state.
`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`

Constructor Detail

### WebApplicationContextFilter

    public WebApplicationContextFilter()

Method Detail

### 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 does nothing, as the filter doesn't store any state.

  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`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2008 Apache Cayenne. All Rights Reserved.