org.codehaus.wadi.core.contextualiser
Class StatelessContextualiser
java.lang.Object
org.codehaus.wadi.core.contextualiser.AbstractChainedContextualiser
org.codehaus.wadi.core.contextualiser.AbstractDelegatingContextualiser
org.codehaus.wadi.core.contextualiser.StatelessContextualiser
- All Implemented Interfaces:
- Contextualiser, Lifecycle
public class StatelessContextualiser
- extends AbstractDelegatingContextualiser
A Contextualiser that will intercept requests that can be shown to be stateless
and run them in a generic stateless Context immediately, without the overhead of
locating the (possibly remote) relevant Context.
Logically, this Contextualiser should sit at the top of the stack, preventing
unecessary cycles being spent locating state that will not actually be consumed
by the incoming request. Actually, taking into account the expense of performing
this check, vs. the expense of checking locally for the session, or locating a
remote session, the sensible place to deploy this Contextualiser may be at the
boundary between local and remote Contextualisers.
If you are caching static content agressively you may not need this Contextualiser.
- Version:
- $Revision: 2287 $
- Author:
- Jules Gosnell
Field Summary |
protected org.apache.commons.logging.Log |
_lockLog
|
protected boolean |
_methodFlag
|
protected java.util.regex.Pattern |
_methods
|
protected boolean |
_uriFlag
|
protected java.util.regex.Pattern |
_uris
|
Method Summary |
boolean |
contextualise(Invocation invocation,
java.lang.String key,
Immoter immoter,
boolean exclusiveOnly)
Contextualise the given Invocation. |
boolean |
isStateful(javax.servlet.http.HttpServletRequest hreq)
We know request is stateful - if, either Pattern matches
stateFULL requests AND match succeeded, or Pattern matches
stateLESS requests AND matched failed |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_methods
protected final java.util.regex.Pattern _methods
_methodFlag
protected final boolean _methodFlag
_uris
protected final java.util.regex.Pattern _uris
_uriFlag
protected final boolean _uriFlag
_lockLog
protected final org.apache.commons.logging.Log _lockLog
StatelessContextualiser
public StatelessContextualiser(Contextualiser next,
java.util.regex.Pattern methods,
boolean methodFlag,
java.util.regex.Pattern uris,
boolean uriFlag)
- Parameters:
next
- - The next Contextualiser in the stackmethods
- - Pattern used to match HTTP method names (null will match nothing)methodFlag
- - Does this Pattern match stateful (true) or stateless (false) HTTP methodsuris
- - Pattern used to match URIs (null will match nothing)uriFlag
- - Does this Pattern match stateful (true) or stateless (false) URIs
contextualise
public boolean contextualise(Invocation invocation,
java.lang.String key,
Immoter immoter,
boolean exclusiveOnly)
throws InvocationException
- Description copied from interface:
Contextualiser
- Contextualise the given Invocation.
- Parameters:
invocation
- the Invocationkey
- the Session keyimmoter
- an Immoter that can be used to promote the Session when foundexclusiveOnly
- whether we should only look in exclusive stores, or descend to shared ones as well
- Returns:
- whether or not the Invocation was contextualised.
- Throws:
InvocationException
isStateful
public boolean isStateful(javax.servlet.http.HttpServletRequest hreq)
- We know request is stateful - if, either Pattern matches
stateFULL requests AND match succeeded, or Pattern matches
stateLESS requests AND matched failed
- Parameters:
hreq
-
- Returns:
- - whether, or not, the request must be assumed stateful
Copyright © 2011. All Rights Reserved.