Class SessionStateAction

  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

$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
Fields inherited from class org.apache.cocoon.acting.AbstractAction
Fields inherited from interface org.apache.cocoon.acting.Action
Constructor Summary
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


protected String statekey


protected String newstate


protected int sublevels


protected int mylevel
Constructor Detail


public SessionStateAction()
Method Detail


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

Specified by:
configure in interface Configurable


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

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