org.apache.cayenne.configuration.web

## Class SessionContextRequestHandler

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

- All Implemented Interfaces:
    RequestHandler

      public class SessionContextRequestHandler
      extends Object
      implements RequestHandler

  Default implementation of the `RequestHandler` that stores per-user `ObjectContext` in a web session and binds it to request thread. Note that using this handler would force `HttpSession` creation, that may not be desirable in many cases. Also session-bound context may result in a race condition with two user requests updating the same persistent objects in parallel.

  User applications in most cases should provide a custom RequestHandler that implements a smarter app-specific strategy for providing ObjectContext.

  For stateless (per request) context creation use `StatelessContextRequestHandler`.

  Since:
    3.1

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SessionContextRequestHandler()`

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

    - #### SessionContextRequestHandler

          public SessionContextRequestHandler()

  - ### 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–2023 Apache Cayenne. All rights reserved.