Class PersistentValve

  • All Implemented Interfaces:
    javax.management.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 Detail

      • filter

        protected java.util.regex.Pattern filter
    • Constructor Detail

      • PersistentValve

        public PersistentValve()
    • Method Detail

      • setContainer

        public void setContainer​(Container container)
        Description copied from class: ValveBase
        Set the Container with which this Valve is associated, if any.
        Specified by:
        setContainer in interface Contained
        Overrides:
        setContainer in class ValveBase
        Parameters:
        container - The new associated container
      • invoke

        public void invoke​(Request request,
                           Response response)
                    throws java.io.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:
        java.io.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​(java.lang.String uri)
      • getFilter

        public java.lang.String getFilter()
      • setFilter

        public void setFilter​(java.lang.String filter)