org.apache.cocoon.acting
Class SessionStateAction

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.acting.AbstractAction
          extended byorg.apache.cocoon.acting.AbstractConfigurableAction
              extended byorg.apache.cocoon.acting.SessionStateAction
All Implemented Interfaces:
org.apache.cocoon.acting.Action, Configurable, ThreadSafe

public class SessionStateAction
extends org.apache.cocoon.acting.AbstractConfigurableAction
implements ThreadSafe

Store the session's current state in a session attribute.

To keep track of the state of a user's session, a string is stored in a session attribute in order to allow to chose between different pipelines in the sitemap accordingly.

For added flexibility it is possible to use sub states as well. For this declare your own name for the session state attribute and give the number of sublevels plus the level to modify. (This is one based!) Sub states below the current one are removed from the session so that the default sub state will be reentered when the user returns. If you don't like this behaviour and prefer independent sub states, use this action several times with different attribute names rather than sub levels.

Global and local parameters:

state-key-prefix String that identifies the attribute that stores the session state in the session object. When sublevels are used, this is a prefix ie. the number of the level is appended to the prefix. Example prefix is "__sessionState", sub-levels is 2, attributes "__sessionState1", "__sessionState2", and "__sessionState3" will be used to store the information.
new-state String that identifies the current state
sub-levels Number of sub levels to use
state-level Sub level to modify, this is one based

Version:
$Id: SessionStateAction.html 1304280 2012-03-23 11:18:01Z ilgrosso $
See Also:
WildcardSessionAttributeMatcher, SessionAttributeSelector

Field Summary
protected  int mylevel
           
protected  String newstate
           
protected  String statekey
           
protected  int sublevels
           
 
Fields inherited from class org.apache.cocoon.acting.AbstractConfigurableAction
settings
 
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
 
Fields inherited from interface org.apache.cocoon.acting.Action
ROLE
 
Constructor Summary
SessionStateAction()
           
 
Method Summary
 Map act(org.apache.cocoon.environment.Redirector redirector, org.apache.cocoon.environment.SourceResolver resolver, Map objectModel, String src, Parameters par)
           
 void configure(Configuration conf)
          Configures the Action.
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statekey

protected String statekey

newstate

protected String newstate

sublevels

protected int sublevels

mylevel

protected int mylevel
Constructor Detail

SessionStateAction

public SessionStateAction()
Method Detail

configure

public void configure(Configuration conf)
               throws ConfigurationException
Configures the Action.

Specified by:
configure in interface Configurable
Throws:
ConfigurationException

act

public Map act(org.apache.cocoon.environment.Redirector redirector,
               org.apache.cocoon.environment.SourceResolver resolver,
               Map objectModel,
               String src,
               Parameters par)
        throws Exception
Specified by:
act in interface org.apache.cocoon.acting.Action
Throws:
Exception


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.