Class NoSessionCreationFilter

  • All Implemented Interfaces:
    Filter, Nameable, PathConfigProcessor

    public class NoSessionCreationFilter
    extends PathMatchingFilter
    A PathMatchingFilter that will disable creating new Sessions during the request. This is a useful filter to place in the front of any filter chains that may result in REST, SOAP or other service invocations that are not intended to participate in a session.

    This filter enables the following behavior:

    1. If a Subject does not yet have a Session by the time this filter is called, this filter effectively disables all calls to subject.getSession() and subject.getSession(true). If either are called during the request, an exception will be thrown.
    2. However, if the Subject already has an associated session before this filter is invoked, either because it was created in another part of the application, or a filter higher in the chain created one, this filter has no effect.
    Finally, calls to subject.getSession(false) (i.e. a false boolean value) will be unaffected and may be called without repercussion in all cases.