Class PersistentValve

All Implemented Interfaces:
MBeanRegistration, Contained, JmxEnabled, Lifecycle, Valve

public class PersistentValve extends ValveBase
Valve that implements per-request session persistence. It is intended to be used with non-sticky load-balancers.

USAGE CONSTRAINT: To work correctly it requires a PersistentManager.

USAGE CONSTRAINT: To work correctly it assumes only one request exists per session at any one time.

Author:
Jean-Frederic Clere
  • Field Details

    • filter

      protected Pattern filter
  • Constructor Details

    • PersistentValve

      public PersistentValve()
  • Method Details

    • setContainer

      public void setContainer(Container container)
      Description copied from interface: Contained
      Set the Container with which this instance is associated.
      Specified by:
      setContainer in interface Contained
      Overrides:
      setContainer in class ValveBase
      Parameters:
      container - The Container instance with which this instance is to be associated, or null to disassociate this instance from any Container
    • invoke

      public void invoke(Request request, Response response) throws IOException, ServletException
      Select the appropriate child Context to process this request, based on the specified request URI. If no matching Context can be found, return an appropriate HTTP error.
      Parameters:
      request - Request to be processed
      response - Response to be produced
      Throws:
      IOException - if an input/output error occurred
      ServletException - if a servlet error occurred
    • isSessionStale

      protected boolean isSessionStale(Session session, long timeNow)
      Indicate whether the session has been idle for longer than its expiration date as of the supplied time. FIXME: Probably belongs in the Session class.
      Parameters:
      session - The session to check
      timeNow - The current time to check for
      Returns:
      true if the session is past its expiration
    • isRequestWithoutSession

      protected boolean isRequestWithoutSession(String uri)
    • getFilter

      public String getFilter()
    • setFilter

      public void setFilter(String filter)