Apache » Cocoon »

  Cocoon FlowScript
      1.0
   homepage

Cocoon FlowScript 1.0

Response Object

The Response object represents the Cocoon response associated with the current request.

The response object contains hooks only to the cookies and to the response headers. Everything else will be controlled by the rest of the cocoon pipeline machinery (like output encoding, for example, which should *NOT* be determined by the flow).

It provides the following functions and properties:

createCookie

Function [Cookie] createCookie([String] name, [String] value)

Creates a new Cookie.

addCookie

Function addCookie([Cookie] cookie)

Adds cookie to the current response.

containsHeader

Function [Boolean] containsHeader([String] name)

Returns whether the current response contains a header with the specified name.

setHeader

Function setHeader([String] name, [String] value)

Replaces the value of the header with name with value.

addHeader

Function addHeader([String] name, [String] value)

Creates a new header in the current response with the specified name and value.

setStatus

Function setStatus([Number] sc)

Sets the status code for this response.

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