apache > cocoon

- Home

# Session Action

The session action helps in managing the session of a user on the server. It can create and terminate a session. The function is controlled by a parameter named 'action'.

For more information on session handling and session contexts have a look at the Session Context documentation.

### Creating a Session

To create a session (if it not already exists) simply add the action in your pipeline:

        <map:act type="session"/>

This is the equivalent to specify the 'action' parameter with the value 'create':

        <map:act type="session">
            <map:parameter name="action" value="create"/>
        </map:act>

### Terminating a Session

Terminating a session is as easy as creating a session, simply add the action to your pipeline and set the 'action' parameter to 'terminate':

        <map:act type="session">
            <map:parameter name="action" value="terminate"/>
        </map:act>

This terminates the session immediately.

You can optionally specifiy the 'mode' parameter which controlls the termination of the session. You have the choice between 'immediately' (the default) and 'if-unsued'. If you use the mode 'if-unused', the session is only terminated, if no session context exists for the user:

        <map:act type="session">
            <map:parameter name="action" value="terminate"/>
            <map:parameter name="mode" value="if-unused"/>
        </map:act>

## Configuration

- Name : session
- Class: org.apache.cocoon.webapps.session.acting.SessionAction

Errors and Improvements? If you see any errors or potential improvements in this document please help us: View, Edit or comment on the latest development version (registration required).