Apache » Cocoon »

  Cocoon FlowScript
      1.0
   homepage

Cocoon FlowScript 1.0

Session Object

The Session object represents the user session associated with the current Cocoon request.

It provides the following functions and properties:

getAttribute

Function [Object] getAttribute([String] name)

Get the value of the session attribute with the specified name.

setAttribute

Function setAttribute([String] name, [Object] value)

Set the value of the session attribute with the specified name to value.

removeAttribute

Function removeAttribute([String] name)

Remove the session attribute with the specified name.

invalidate

Function invalidate()

Invalidate this session, releasing all resources associated with it.

isNew

Function [Boolean] isNew()

Returns true if the client does not yet know about the session or if the client chooses not to join the session. For example, if the server used only cookie-based sessions, and the client had disabled the use of cookies, then a session would be new on each request.

getId

Function [String] getId()

Returns the unique id associated with this session.

getCreationTime

Function [Number] getCreationTime()

Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.

getLastAccessedTime

Function [Number] getLastAccessedTime()

Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight January 1, 1970 GMT.

setMaxInactiveInterval

Function setMaxInactiveInterval([Number] interval)

Specifies the time, in seconds, between client requests before the contextcontainer will invalidate this session. A negative time indicates the session should never timeout.

getMaxInactiveInterval

Function [Number] getMaxInactiveInterval()

Returns the maximum time interval, in seconds, that the context container will keep this session open between client accesses. After this interval, the context container will invalidate the session. The maximum time interval can be set with the setMaxInactiveInterval method. A negative time indicates the session should never timeout.

Properties

Session properties map to session attributes, i.e. session.blah is equivalent to session.getAttribute("blah").

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).