# Interface HttpSession.Accessor

Enclosing interface:
  `HttpSession`

public static interface HttpSession.Accessor
Provides a mechanism for applications to interact with the `HttpSession` outside of the scope of an HTTP request.

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

- ## Method Details

  - ### access

    void access(Consumer<HttpSession> sessionConsumer)
    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.

    Parameters:
      `sessionConsumer` - the application provided `Consumer` instance that will access the session
    Throws:
      `IllegalStateException` - if the session with the ID to which the `HttpSession.Accessor` is associated is no longer valid