org.codehaus.wadi.impl
Class StatelessContextualiser

java.lang.Object
  extended byorg.codehaus.wadi.impl.AbstractContextualiser
      extended byorg.codehaus.wadi.impl.AbstractChainedContextualiser
          extended byorg.codehaus.wadi.impl.AbstractDelegatingContextualiser
              extended byorg.codehaus.wadi.impl.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: 1430 $
Author:
Jules Gosnell

Field Summary
protected  Log _lockLog
           
protected  boolean _methodFlag
           
protected  Pattern _methods
           
protected  boolean _uriFlag
           
protected  Pattern _uris
           
 ThreadLocal _wrapper
           
 
Fields inherited from class org.codehaus.wadi.impl.AbstractChainedContextualiser
_next
 
Fields inherited from class org.codehaus.wadi.impl.AbstractContextualiser
_log
 
Constructor Summary
StatelessContextualiser(Contextualiser next, Pattern methods, boolean methodFlag, Pattern uris, boolean uriFlag)
           
 
Method Summary
 boolean contextualise(InvocationContext invocationContext, String id, Immoter immoter, Sync invocationLock, boolean exclusiveOnly)
           
 boolean isStateful(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 org.codehaus.wadi.impl.AbstractDelegatingContextualiser
getDemoter, getLocalSessionCount, getSharedDemoter, isExclusive, load, promoteToExclusive
 
Methods inherited from class org.codehaus.wadi.impl.AbstractChainedContextualiser
destroy, findRelevantSessionNames, init, setLastAccessedTime, setMaxInactiveInterval, start, stop
 
Methods inherited from class org.codehaus.wadi.impl.AbstractContextualiser
getStartInfo, getStopInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_methods

protected final Pattern _methods

_methodFlag

protected final boolean _methodFlag

_uris

protected final Pattern _uris

_uriFlag

protected final boolean _uriFlag

_lockLog

protected final Log _lockLog

_wrapper

public ThreadLocal _wrapper
Constructor Detail

StatelessContextualiser

public StatelessContextualiser(Contextualiser next,
                               Pattern methods,
                               boolean methodFlag,
                               Pattern uris,
                               boolean uriFlag)
Parameters:
next - - The next Contextualiser in the stack
methods - - Pattern used to match HTTP method names (null will match nothing)
methodFlag - - Does this Pattern match stateful (true) or stateless (false) HTTP methods
uris - - Pattern used to match URIs (null will match nothing)
uriFlag - - Does this Pattern match stateful (true) or stateless (false) URIs
Method Detail

contextualise

public boolean contextualise(InvocationContext invocationContext,
                             String id,
                             Immoter immoter,
                             Sync invocationLock,
                             boolean exclusiveOnly)
                      throws InvocationException
Throws:
InvocationException

isStateful

public boolean isStateful(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 © 2004-2006 Core Developers Network Ltd.. All Rights Reserved.