You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by da...@cocoon.zones.apache.org on 2007/06/07 18:51:03 UTC

[DAISY] Created: Request Object

A new document has been created.

http://cocoon.zones.apache.org/daisy/documentation/1383.html

Document ID: 1383
Branch: main
Language: default
Name: Request Object
Document Type: Cocoon Document
Created: 6/7/07 4:50:51 PM
Creator (owner): Reinhard Pötz
State: publish

Parts
=====

Content
-------
Mime type: text/xml
Size: 15157 bytes
Content:
<html>
<body>

<p>The <tt>Request</tt> object represents the current Cocoon request. It
provides the following functions and properties:</p>

<h3>get</h3>

<p><em>Function</em> <tt>[String] get([String] name)</tt></p>

<p>Get the request parameter or attribute with the specified <tt>name</tt>.</p>

<h3>getAttribute</h3>

<p><em>Function</em> <tt>[String] getAttribute([String] name)</tt></p>

<p>Get the request attribute with the specified <tt>name</tt>.</p>

<h3>getAttributeNames</h3>

<p><em>Function</em> <tt>[java.util.Enumeration] getAttributeNames()</tt></p>

<p>Get an enumeration of request attribute names.</p>

<h3>setAttribute</h3>

<p><em>Function</em> <tt>setAttribute([String] name, [Object] value)</tt></p>

<p>Set the value of a request attribute.</p>

<h3>removeAttribute</h3>

<p><em>Function</em> <tt>removeAttribute([String] name)</tt></p>

<p>Remove the attribute with the name <tt>name</tt> from this request.</p>

<h3>getCharacterEncoding</h3>

<p><em>Function</em> <tt>[String]getCharacterEncoding()</tt></p>

<p>Return the character encoding used by this request.</p>

<h3>setCharacterEncoding</h3>

<p><em>Function</em> <tt>setCharacterEncoding([String] value)</tt></p>

<p>Set the character encoding used by this request.</p>

<h3>getContentLength</h3>

<p><em>Function</em> <tt>[Number] getContentLength()</tt></p>

<p>Get the content-length of this request</p>

<h3>getContentType</h3>

<p><em>Function</em> <tt>[String] getContentType()</tt></p>

<p>Get the content-type of this request</p>

<h3>getParameter</h3>

<p><em>Function</em> <tt>[String] getParameter([String] name)</tt></p>

<p>Get the request parameter with the specified <tt>name</tt>.</p>

<h3>getParameterValues</h3>

<p><em>Function</em> <tt>[Array] getParameterValues([String] name)</tt></p>

<p>Get an array of request parameters with the specified <tt>name</tt>.</p>

<h3>getParameterNames</h3>

<p><em>Function</em> <tt>[java.util.Enumeration] getParameterNames()</tt></p>

<p>Get an enumeration of the parameter names in this request.</p>

<h3>getAuthType</h3>

<p><em>Function</em> <tt>[String] getAuthType()</tt></p>

<p>Get the authorization type used in this request.</p>

<h3>getProtocol</h3>

<p><em>Function</em> <tt>[String] getProtocol()</tt></p>

<p>Get the protocol used in this request.</p>

<h3>getScheme</h3>

<p><em>Function</em> <tt>[String] getScheme()</tt></p>

<p>Get the scheme used in this request.</p>

<h3>getMethod</h3>

<p><em>Function</em> <tt>[String] getMethod()</tt></p>

<p>Get the method used in this request.</p>

<h3>getServerName</h3>

<p><em>Function</em> <tt>[String] getServerName()</tt></p>

<p>Get the server name of this request.</p>

<h3>getServerPort</h3>

<p><em>Function</em> <tt>[Number] getServerPort()</tt></p>

<p>Get the server port of this request.</p>

<h3>getRemoteAddr</h3>

<p><em>Function</em> <tt>[String] getRemoteAddr()</tt></p>

<p>Get the remote address of this request.</p>

<h3>isSecure</h3>

<p><em>Function</em> <tt>[Boolean] isSecure()</tt></p>

<p>Get the <tt>secure</tt> property of this request.</p>

<h3>getLocale</h3>

<p><em>Function</em> <tt>[String] getLocale()</tt></p>

<p>Get the locale of this request.</p>

<h3>getLocales</h3>

<p><em>Function</em> <tt>[Array [String]] getLocales()</tt></p>

<p>Get the locales of this request.</p>

<h3>getCookies</h3>

<p><em>Function</em> <tt>[Array [Cookie]] getCookies()</tt></p>

<p>Get the cookies associated with this request.</p>

<h3>getHeader</h3>

<p><em>Function</em> <tt>[String] getHeader([String] name)</tt></p>

<p>Get the header with <tt>name</tt> from this request.</p>

<h3>getHeaders</h3>

<p><em>Function</em> <tt>[Array] getHeaders()</tt></p>

<p>Get the headers associated with this request.</p>

<h3>getHeaderNames</h3>

<p><em>Function</em> <tt>[java.util.Enumeration] getHeaderNames()</tt></p>

<p>Get an enumeration of header names from this request.</p>

<h3>getRemoteUser</h3>

<p><em>Function</em> <tt>[String] getRemoteUser()</tt></p>

<p>Get the remote user associated with this request.</p>

<h3>getUserPrincipal</h3>

<p><em>Function</em> <tt>[String] getUserPrincipal()</tt></p>

<p>Get the user principal associated with this request.</p>

<h3>isUserInRole</h3>

<p><em>Function</em> <tt>[Boolean] isUserInRole([String] role)</tt></p>

<p>Returns whether the user associated with this request is in the specified
<tt>role</tt>.</p>

<h3>Properties</h3>

<p><tt>Request</tt> properties map to request parameters, i.e.
<tt>request.blah</tt> is equivalent to <tt>request.getParameter("blah")</tt>.
</p>

<h2 id="response">Response Object</h2>

<p>The <tt>Response</tt> object represents the Cocoon response associated with
the current request.</p>

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

<p>It provides the following functions and properties:</p>

<h3>createCookie</h3>

<p><em>Function</em> <tt>[Cookie] createCookie([String] name, [String]
value)</tt></p>

<p>Creates a new <a href="#cookie">Cookie</a>.</p>

<h3>addCookie</h3>

<p><em>Function</em> <tt>addCookie([Cookie] cookie)</tt></p>

<p>Adds <tt>cookie</tt> to the current response.</p>

<h3>containsHeader</h3>

<p><em>Function</em> <tt>[Boolean] containsHeader([String] name)</tt></p>

<p>Returns whether the current response contains a header with the specified
<tt>name</tt>.</p>

<h3>setHeader</h3>

<p><em>Function</em> <tt>setHeader([String] name, [String] value)</tt></p>

<p>Replaces the value of the header with <tt>name</tt> with <tt>value</tt>.</p>

<h3>addHeader</h3>

<p><em>Function</em> <tt>addHeader([String] name, [String] value)</tt></p>

<p>Creates a new header in the current response with the specified <tt>name</tt>
and <tt>value</tt>.</p>

<h3>setStatus</h3>

<p><em>Function</em> <tt>setStatus([Number] sc)</tt></p>

<p>Sets the status code for this response.</p>

<h2 id="session">Session Object</h2>

<p>The <tt>Session</tt> object represents the user session associated with the
current Cocoon request.</p>

<p>It provides the following functions and properties:</p>

<h3>getAttribute</h3>

<p><em>Function</em> <tt>[Object] getAttribute([String] name)</tt></p>

<p>Get the value of the session attribute with the specified <tt>name</tt>.</p>

<h3>setAttribute</h3>

<p><em>Function</em> <tt>setAttribute([String] name, [Object] value)</tt></p>

<p>Set the value of the session attribute with the specified <tt>name</tt> to
<tt>value</tt>.</p>

<h3>removeAttribute</h3>

<p><em>Function</em> <tt>removeAttribute([String] name)</tt></p>

<p>Remove the session attribute with the specified <tt>name</tt>.</p>

<h3>invalidate</h3>

<p><em>Function</em> <tt>invalidate()</tt></p>

<p>Invalidate this session, releasing all resources associated with it.</p>

<h3>isNew</h3>

<p><em>Function</em> <tt>[Boolean] isNew()</tt></p>

<p>Returns <tt>true</tt> 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.</p>

<h3>getId</h3>

<p><em>Function</em> <tt>[String] getId()</tt></p>

<p>Returns the unique id associated with this session.</p>

<h3>getCreationTime</h3>

<p><em>Function</em> <tt>[Number] getCreationTime()</tt></p>

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

<h3>getLastAccessedTime</h3>

<p><em>Function</em> <tt>[Number] getLastAccessedTime()</tt></p>

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

<h3>setMaxInactiveInterval</h3>

<p><em>Function</em> <tt>setMaxInactiveInterval([Number] interval)</tt></p>

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

<h3>getMaxInactiveInterval</h3>

<p><em>Function</em> <tt>[Number] getMaxInactiveInterval()</tt></p>

<p>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 <tt>setMaxInactiveInterval</tt> method. A negative time indicates
the session should never timeout.</p>

<h3>Properties</h3>

<p><tt>Session</tt> properties map to session attributes, i.e.
<tt>session.blah</tt> is equivalent to <tt>session.getAttribute("blah")</tt>.
</p>

<h2 id="context">Context Object</h2>

<p>The <tt>Context</tt> object represents the client context associated with the
current Cocoon request.</p>

<p>It provides the following functions and properties:</p>

<h3>getAttribute</h3>

<p><em>Function</em> <tt>[Object] getAttribute([String] name)</tt></p>

<p>Get the value of the context attribute with the specified <tt>name</tt>.</p>

<h3>setAttribute</h3>

<p><em>Function</em> <tt>setAttribute([String] name, [Object] value)</tt></p>

<p>Set the value of the context attribute with the specified <tt>name</tt> to
<tt>value</tt>.</p>

<h3>removeAttribute</h3>

<p><em>Function</em> <tt>removeAttribute([String] name)</tt></p>

<p>Remove the context attribute with the specified <tt>name</tt>.</p>

<h3>getInitParameter</h3>

<p><em>Function</em> <tt>getInitParameter([String] name)</tt></p>

<p>Get the value of the context initialization parameter with the specified
<tt>name</tt>.</p>

<h3>Properties</h3>

<p><tt>Context</tt> properties map to context attributes, i.e.
<tt>context.blah</tt> is equivalent to <tt>context.getAttribute("blah")</tt>.
</p>

<h2 id="cookie">Cookie Object</h2>

<p><tt>Cookie</tt> provides the following functions and properties:</p>

<h3>getName</h3>

<p><em>Function</em> <tt>[String] getName()</tt></p>

<p>Get the name of this cookie.</p>

<h3>getVersion</h3>

<p><em>Function</em> <tt>[String] getVersion()</tt></p>

<p>Get the version of this cookie.</p>

<h3>setVersion</h3>

<p><em>Function</em> <tt>setVersion([String] version)</tt></p>

<p>Set the version of this cookie.</p>

<h3>getValue</h3>

<p><em>Function</em> <tt>[String] getValue()</tt></p>

<p>Get the value of this cookie.</p>

<h3>setValue</h3>

<p><em>Function</em> <tt>setValue([String] value)</tt></p>

<p>Set the value of this cookie.</p>

<h3>getComment</h3>

<p><em>Function</em> <tt>[String] getComment()</tt></p>

<p>Get the comment of this cookie.</p>

<h3>setComment</h3>

<p><em>Function</em> <tt>setComment([String] comment)</tt></p>

<p>Set the comment of this cookie.</p>

<h3>getDomain</h3>

<p><em>Function</em> <tt>[String] getDomain()</tt></p>

<p>Get the domain of this cookie.</p>

<h3>setDomain</h3>

<p><em>Function</em> <tt>setDomain([String] domain)</tt></p>

<p>Set the domain of this cookie.</p>

<h3>getPath</h3>

<p><em>Function</em> <tt>[String] getPath()</tt></p>

<p>Get the path of this cookie.</p>

<h3>setPath</h3>

<p><em>Function</em> <tt>setPath([String] path)</tt></p>

<p>Set the path of this cookie.</p>

<h3>getSecure</h3>

<p><em>Function</em> <tt>[Boolean] getSecure()</tt></p>

<p>Get the secure property of this cookie.</p>

<h3>setSecure</h3>

<p><em>Function</em> <tt>setSecure([Boolean] value)</tt></p>

<p>Set the secure property of this cookie.</p>

<h2 id="log">Log Object</h2>

<p>The <tt>Log</tt> object provides an interface to the Cocoon logging system.
</p>

<p>It supports the following functions:</p>

<h3>error</h3>

<p><em>Function</em> <tt>error([String] message, [java.lang.Throwable]
exception)</tt></p>

<p>Log an error message. If <tt>exception</tt> is provided its stack trace will
also be logged.</p>

<h3>debug</h3>

<p><em>Function</em> <tt>debug([String] message, [java.lang.Throwable]
exception)</tt></p>

<p>Log a debug message. If <tt>exception</tt> is provided its stack trace will
also be logged.</p>

<h3>warn</h3>

<p><em>Function</em> <tt>warn([String] message, [java.lang.Throwable]
exception)</tt></p>

<p>Log a warning message. If <tt>exception</tt> is provided its stack trace will
also be logged.</p>

<h3>info</h3>

<p><em>Function</em> <tt>info([String] message, [java.lang.Throwable]
exception)</tt></p>

<p>Log an information message. If <tt>exception</tt> is provided its stack trace
will also be logged.</p>

<h3>isErrorEnabled</h3>

<p><em>Function</em> <tt>[Boolean] isErrorEnabled()</tt></p>

<p>Returns whether error message logging is enabled.</p>

<h3>isDebugEnabled</h3>

<p><em>Function</em> <tt>[Boolean] isDebugEnabled()</tt></p>

<p>Returns whether debug message logging is enabled.</p>

<h3>isWarnEnabled</h3>

<p><em>Function</em> <tt>[Boolean] isWarnEnabled()</tt></p>

<p>Returns whether warning message logging is enabled.</p>

<h3>isInfoEnabled</h3>

<p><em>Function</em> <tt>[Boolean] isInfoEnabled()</tt></p>

<p>Returns whether information message logging is enabled.</p>

<h2 id="WebContinuation">WebContinuation</h2>

<p>A <tt>WebContinuation</tt> represents a continuation of a Flowscript. Because
a user may click on the back button in the browser and restart a saved
computation in a continuation, each <tt>WebContinuation</tt> becomes the parent
of a subtree of continuations.</p>

<p>If there is no parent <tt>WebContinuation</tt>, the created continuation
becomes the root of a tree of <tt>WebContinuation</tt>s.</p>

<p><tt>WebContinuation</tt> objects support the following functions and
properties:</p>

<h3>id</h3>

<p><em>Property</em> <tt>[String] id</tt></p>

<p>Returns the unique string identifier of this Web Continuation.</p>

<h3>continuation</h3>

<p><em>Property</em> <tt>[Continuation] continuation</tt></p>

<p>Returns the JavaScript continuation associated with this Web Continuation.
</p>

<h3>previousBookmark</h3>

<p><em>Property</em> <tt>[WebContinuation] previousBookmark</tt></p>

<p>Returns a reference to the first bookmark continuation among the pages
preceding the one associated with this object, or null if no such bookmark
continuation exists. The returned object is the continuation you would invoke to
implement a "Back" button.</p>

<h3>isBookmark</h3>

<p><em>Function</em> <tt>[Boolean] isBookmark()</tt></p>

<p>Returns <tt>true</tt> if this continuation was <em>not</em> created by
<a href="#sendPageAndWait">sendPageAndWait</a>.</p>

<h3>getParent</h3>

<p><em>Function</em> <tt>[WebContinuation] getParent()</tt></p>

<p>Get the parent continuation of this continuation.</p>

<h3>getChildren</h3>

<p><em>Function</em> <tt>[Array [WebContinuation]] getChildren()</tt></p>

<p>Get the child continuations of this continuation.</p>

<h3>invalidate</h3>

<p><em>Function</em> <tt>invalidate()</tt></p>

<p>Invalidates a <tt>WebContinuation</tt>. This effectively means that the
continuation object associated with it will no longer be accessible from Web
pages. Invalidating a <tt>WebContinuation</tt> invalidates all the
<tt>WebContinuation</tt>s which are children of it.</p>

</body>
</html>

Collections
===========
The document belongs to the following collections: cdocs-flowscript