org.apache.cayenne.remote.service

## Class HttpRemoteService

- java.lang.Object
- - org.apache.cayenne.remote.service.BaseRemoteService
  - - org.apache.cayenne.remote.service.HttpRemoteService

- All Implemented Interfaces:
    Remote, RemoteService
  Direct Known Subclasses:
    HessianService, ServerHttpRemoteService

      public abstract class HttpRemoteService
      extends BaseRemoteService

  A `RemoteService` implementation that stores server context information in HTTP sessions.
  Since:
    1.2

- - ### Field Summary

    - ### Fields inherited from class org.apache.cayenne.remote.service.BaseRemoteService

      `contextFactory, eventBridgeFactoryName, eventBridgeParameters, logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpRemoteService(ObjectContextFactory contextFactory, Map<String,String> eventBridgeProperties)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected ServerSession` | `createServerSession()` Creates a new ServerSession with a dedicated DataChannel.
    `protected ServerSession` | `createServerSession(String name)` Creates a new ServerSession based on a shared DataChannel.
    `protected ServerSession` | `getServerSession()` Returns a ServerSession object that represents Cayenne-related state associated with the current session.
    `protected abstract javax.servlet.http.HttpSession` | `getSession(boolean create)` Returns an HttpSession associated with the current request in progress.
    `protected DataChannel` | `getSharedChannel(String name)`
    `protected void` | `saveSharedChannel(String name, DataChannel channel)`

    - ### Methods inherited from class org.apache.cayenne.remote.service.BaseRemoteService

      `close, createChannel, createRemoteSession, establishSession, establishSharedSession, getEventBridgeFactoryName, getEventBridgeParameters, initEventBridgeParameters, processMessage`

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

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

- - ### Constructor Detail

    - #### HttpRemoteService

          public HttpRemoteService(ObjectContextFactory contextFactory,
                                   Map<String,String> eventBridgeProperties)

      Since:
        3.1

  - ### Method Detail

    - #### getSession

          protected abstract javax.servlet.http.HttpSession getSession(boolean create)

      Returns an HttpSession associated with the current request in progress.

    - #### getServerSession

          protected ServerSession getServerSession()

      Returns a ServerSession object that represents Cayenne-related state associated with the current session. If ServerSession hasn't been previously saved, returns null.
      Specified by:
        `getServerSession` in class `BaseRemoteService`

    - #### createServerSession

          protected ServerSession createServerSession()

      Creates a new ServerSession with a dedicated DataChannel. Returned ServerSession is stored in HttpSession for future reuse.
      Specified by:
        `createServerSession` in class `BaseRemoteService`

    - #### createServerSession

          protected ServerSession createServerSession(String name)

      Creates a new ServerSession based on a shared DataChannel. Returned ServerSession is stored in HttpSession for future reuse.
      Specified by:
        `createServerSession` in class `BaseRemoteService`
      Parameters:
        `name` - shared session name used to lookup a shared DataChannel.

    - #### getSharedChannel

          protected DataChannel getSharedChannel(String name)

    - #### saveSharedChannel

          protected void saveSharedChannel(String name,
                                           DataChannel channel)

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