StandardSessionAccessor (Apache Tomcat 11.0.25 API Documentation)
Description: declaration: package: org.apache.catalina.session, class: StandardSessionAccessor

# Class StandardSessionAccessor

java.lang.Object
org.apache.catalina.session.StandardSessionAccessor

All Implemented Interfaces:
  `HttpSession.Accessor`

public class StandardSessionAccessor extends Object implements HttpSession.Accessor
Accessor for a StandardSession object.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `StandardSessionAccessor(Manager manager, String id)`
  Construct a new session accessor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `access(Consumer<HttpSession> sessionConsumer)`
  Call to access the session with the same semantics as if the session was accessed during an HTTP request.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### StandardSessionAccessor

    public StandardSessionAccessor(Manager manager, String id)
    Construct a new session accessor.
    Parameters:
      `manager` - The manager that owns the session
      `id` - The session identifier

- ## Method Details

  - ### access

    public void access(Consumer<HttpSession> sessionConsumer)
    Description copied from interface: `jakarta.servlet.http.HttpSession.Accessor`
    Call to access the session with the same semantics as if the session was accessed during an HTTP request.

    The effect of this call on the session is as if an HTTP request starts; `Consumer.accept(Object)` is called with the associated session object enabling the application to interact with the session; and, once that method returns, the HTTP request ends.

    Specified by:
      `access` in interface `HttpSession.Accessor`
    Parameters:
      `sessionConsumer` - the application provided `Consumer` instance that will access the session