org.apache.cayenne.configuration.web

## Class StatelessContextRequestHandler

- java.lang.Object
- - org.apache.cayenne.configuration.web.StatelessContextRequestHandler

- All Implemented Interfaces:
    RequestHandler

      public class StatelessContextRequestHandler
      extends Object
      implements RequestHandler

  Stateless implementation of `RequestHandler` that creates a new `ObjectContext` for each request and binds it to the request thread.

  This is an alternative to the session-based request handler `SessionContextRequestHandler` which is the default.

  The request handler can be used by injecting it with a custom @{link Module}, like so:

      import org.apache.cayenne.configuration.web.RequestHandler;
      import org.apache.cayenne.configuration.web.StatelessContextRequestHandler;
      import org.apache.cayenne.di.Binder;
      import org.apache.cayenne.di.Module;
      public class AppModule implements Module {
          public void configure(Binder binder) {
              binder.bind(RequestHandler.class).to(StatelessContextRequestHandler.class);
          }
      }

  Since:
    4.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StatelessContextRequestHandler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `requestEnd(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)`
    `void` | `requestStart(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StatelessContextRequestHandler

          public StatelessContextRequestHandler()

  - ### Method Detail

    - #### requestStart

          public void requestStart(javax.servlet.ServletRequest request,
                                   javax.servlet.ServletResponse response)

      Specified by:
        `requestStart` in interface `RequestHandler`

    - #### requestEnd

          public void requestEnd(javax.servlet.ServletRequest request,
                                 javax.servlet.ServletResponse response)

      Specified by:
        `requestEnd` in interface `RequestHandler`

Copyright © 2001–2018 Apache Cayenne. All rights reserved.