Interface HttpSession.Accessor

  • Enclosing interface:
    HttpSession

    public static interface HttpSession.Accessor
    An accessor for applications to interact with a HttpSession outside of the scope of an HTTP request.
    • Method Detail

      • access

        void access​(Consumer<HttpSession> sessionConsumer)
        Call to access the HttpSession used to obtain this Accessor from outside the scope of a HTTP request.

        When called, the container will call the Consumer.accept(Object) method of the sessionConsumer passed by the application, with an HttpSession object that represents the same HttpSession that this Accessor was obtained from.

        The passed HttpSession may be the same instance as used to obtain this Accessor, or a new instance for the session which has possibly been passivated and activated since the Accessor was obtained.

        The passed HttpSession may be shared concurrently with other Accessors for the same session, other calls to this Accessor and/or Servlets and Filters.

        The passed HttpSession must not be used or referenced outside the scope of the call to the Consumer.accept(Object) method of sessionConsumer.

        For the purposes of session access, validity, passivation, activation etc. the container behaves as if the call to the Consumer.accept(Object) method of sessionConsumer occurs during the processing of an HTTP request for the same session.

        Parameters:
        sessionConsumer - the application provided Consumer of HttpSession to access the session.
        Throws:
        IllegalStateException - if this method is called on an invalidated session or if the session ID has changed since the Accessor was obtained.