| org.apache.cocoon.environment.Request
All known Subclasses: org.apache.cocoon.environment.wrapper.RequestWrapper, org.apache.cocoon.environment.mock.MockRequest, org.apache.cocoon.environment.commandline.CommandLineRequest, org.apache.cocoon.environment.portlet.PortletRequest, org.apache.cocoon.environment.http.HttpRequest,
Method Summary | |
Object | get(String name) Returns the value of the named attribute as an Object ,
or null if no attribute of the given name exists. | Object | getAttribute(String name) Returns the value of the named attribute as an Object ,
or null if no attribute of the given name exists. | Enumeration | getAttributeNames() Returns an Enumeration containing the
names of the attributes available to this request. | String | getAuthType() | String | getCharacterEncoding() Returns the name of the character encoding used in the body of this
request. | int | getContentLength() | String | getContentType() | String | getContextPath() Returns the portion of the request URI that indicates the context
of the request. | Map | getCookieMap() Returns a map of the Cookie objects the client sent
with this request, indexed by name. | Cookie[] | getCookies() Returns an array containing all of the Cookie
objects the client sent with this request. | long | getDateHeader(String name) Returns the value of the specified request header
as a long value that represents a
Date object. | String | getHeader(String name) Returns the value of the specified request header
as a String . | Enumeration | getHeaderNames() Returns an enumeration of all the header names
this request contains. | Enumeration | getHeaders(String name) Returns all the values of the specified request header
as an Enumeration of String objects.
Some headers, such as Accept-Language can be sent
by clients as several headers each with a different value rather than
sending the header as a comma separated list.
If the request did not include any headers
of the specified name, this method returns an empty
Enumeration .
The header name is case insensitive. | Locale | getLocale() Returns the preferred Locale that the client will
accept content in, based on the Accept-Language header. | Enumeration | getLocales() Returns an Enumeration of Locale objects
indicating, in decreasing order starting with the preferred locale, the
locales that are acceptable to the client based on the Accept-Language
header. | String | getMethod() Returns the name of the HTTP method with which this
request was made, for example, GET, POST, or PUT. | String | getParameter(String name) | Enumeration | getParameterNames() Returns an Enumeration of String
objects containing the names of the parameters contained
in this request. | String[] | getParameterValues(String name) Returns an array of String objects containing
all of the values the given request parameter has, or
null if the parameter does not exist. | String | getPathInfo() Returns any extra path information associated with
the URL the client sent when it made this request. | String | getPathTranslated() Returns any extra path information after the servlet name
but before the query string, and translates it to a real
path. | String | getProtocol() Returns the name and version of the protocol the request uses
in the form protocol/majorVersion.minorVersion, for
example, HTTP/1.1. | String | getQueryString() Returns the query string that is contained in the request
URL after the path. | String | getRemoteAddr() Returns the Internet Protocol (IP) address of the client
that sent the request. | String | getRemoteHost() Returns the fully qualified name of the client that sent the
request, or the IP address of the client if the name cannot be
determined. | String | getRemoteUser() Returns the login of the user making this request, if the
user has been authenticated, or null if the user
has not been authenticated.
Whether the user name is sent with each subsequent request
depends on the browser and type of authentication. | String | getRequestURI() Returns the part of this request's URL from the protocol
name up to the query string in the first line of the HTTP request. | String | getRequestedSessionId() Returns the session ID specified by the client. | String | getScheme() Returns the name of the scheme used to make this request,
for example,
http , https , or ftp . | String | getServerName() Returns the host name of the server that received the request. | int | getServerPort() Returns the port number on which this request was received. | String | getServletPath() Returns the part of this request's URL that calls
the servlet. | Session | getSession(boolean create) Returns the current Session
associated with this request or, if if there is no
current session and create is true, returns
a new session. | Session | getSession() Returns the current session associated with this request,
or if the request does not have a session, creates one. | String | getSitemapURI()
Returns the URI of the requested resource as interpreted by the sitemap.
For example, if your webapp is mounted at "/webapp" and the HTTP request
is for "/webapp/foo", this method returns "foo". | String | getSitemapURIPrefix()
Returns the URI Prefix of the requested resource where the sitemap is mounted. | Principal | getUserPrincipal() Returns the login of the user making this request, if the
user has been authenticated, or null if the user
has not been authenticated.
Whether the user name is sent with each subsequent request
depends on the browser and type of authentication. | boolean | isRequestedSessionIdFromCookie() Checks whether the requested session ID came in as a cookie. | boolean | isRequestedSessionIdFromURL() Checks whether the requested session ID came in as part of the
request URL. | boolean | isRequestedSessionIdValid() Checks whether the requested session ID is still valid. | boolean | isSecure() Returns a boolean indicating whether this request was made using a
secure channel, such as HTTPS. | boolean | isUserInRole(String role) Checks whether the currently logged in user is in a specified role. | void | removeAttribute(String name) Removes an attribute from this request. | void | setAttribute(String name, Object o) Stores an attribute in this request.
Attributes are reset between requests.
Attribute names should follow the same conventions as
package names. | void | setCharacterEncoding(String enc) Overrides the charactor encoding of parameters. |
get | Object get(String name)(Code) | | Returns the value of the named attribute as an Object ,
or null if no attribute of the given name exists.
Parameters: name - a String specifying the name ofthe attribute an Object containing the valueof the attribute, or null ifthe attribute does not exist |
getAttribute | Object getAttribute(String name)(Code) | | Returns the value of the named attribute as an Object ,
or null if no attribute of the given name exists.
Parameters: name - a String specifying the name ofthe attribute an Object containing the valueof the attribute, or null ifthe attribute does not exist |
getAttributeNames | Enumeration getAttributeNames()(Code) | | Returns an Enumeration containing the
names of the attributes available to this request.
This method returns an empty Enumeration
if the request has no attributes available to it.
an Enumeration of stringscontaining the namesof the request's attributes |
getAuthType | String getAuthType()(Code) | | Returns the name of the authentication scheme used to protect
the servlet, for example, "BASIC" or "SSL," or null if the servlet was
not protected
The name of the authentication scheme used toprotect the servlet, or null if the servlet wasnot protected |
getCharacterEncoding | String getCharacterEncoding()(Code) | | Returns the name of the character encoding used in the body of this
request. This method returns null if the request
does not specify a character encoding
a String containing the name ofthe chararacter encoding, or null if the request does not specify a character encoding |
getContentLength | int getContentLength()(Code) | | Returns the length, in bytes, of the request body
an integer containing the length of therequest body or -1 if the length is not known |
getContentType | String getContentType()(Code) | | Returns the MIME type of the body of the request
a String containing the nameof the MIME type ofthe request, or -1 if the type is not known |
getContextPath | String getContextPath()(Code) | | Returns the portion of the request URI that indicates the context
of the request. The context path always comes first in a request
URI. The path starts with a "/" character but does not end with a "/"
character. For servlets in the default (root) context, this method
returns "".
a String specifying theportion of the request URI that indicates the contextof the request |
getCookieMap | Map getCookieMap()(Code) | | Returns a map of the Cookie objects the client sent
with this request, indexed by name. This method returns an empty
map if no cookies were sent.
a Map of Cookie objects |
getCookies | Cookie[] getCookies()(Code) | | Returns an array containing all of the Cookie
objects the client sent with this request.
This method returns null if no cookies were sent.
an array of all the Cookies included with this request, or null if the request has no cookies |
getDateHeader | long getDateHeader(String name)(Code) | | Returns the value of the specified request header
as a long value that represents a
Date object. Use this method with
headers that contain dates, such as
If-Modified-Since .
The date is returned as
the number of milliseconds since January 1, 1970 GMT.
The header name is case insensitive.
If the request did not have a header of the
specified name, this method returns -1. If the header
can't be converted to a date, the method throws
an IllegalArgumentException .
Parameters: name - a String specifying thename of the header a long valuerepresenting the date specifiedin the header expressed asthe number of millisecondssince January 1, 1970 GMT,or -1 if the named headerwas not included with thereqest exception: IllegalArgumentException - If the header valuecan't be convertedto a date |
getHeader | String getHeader(String name)(Code) | | Returns the value of the specified request header
as a String . If the request did not include a header
of the specified name, this method returns null .
The header name is case insensitive. You can use
this method with any request header.
Parameters: name - a String specifying theheader name a String containing thevalue of the requestedheader, or null if the request does nothave a header of that name |
getHeaderNames | Enumeration getHeaderNames()(Code) | | Returns an enumeration of all the header names
this request contains. If the request has no
headers, this method returns an empty enumeration.
Some servlet containers do not allow do not allow
servlets to access headers using this method, in
which case this method returns null
an enumeration of all theheader names sent with thisrequest; if the request hasno headers, an empty enumeration;if the servlet container does notallow servlets to use this method,null |
getHeaders | Enumeration getHeaders(String name)(Code) | | Returns all the values of the specified request header
as an Enumeration of String objects.
Some headers, such as Accept-Language can be sent
by clients as several headers each with a different value rather than
sending the header as a comma separated list.
If the request did not include any headers
of the specified name, this method returns an empty
Enumeration .
The header name is case insensitive. You can use
this method with any request header.
Parameters: name - a String specifying theheader name a Enumeration containing thevalues of the requestedheader, or null if the request does nothave any headers of that name |
getLocale | Locale getLocale()(Code) | | Returns the preferred Locale that the client will
accept content in, based on the Accept-Language header.
If the client request doesn't provide an Accept-Language header,
this method returns the default locale for the server.
the preferred Locale for the client |
getLocales | Enumeration getLocales()(Code) | | Returns an Enumeration of Locale objects
indicating, in decreasing order starting with the preferred locale, the
locales that are acceptable to the client based on the Accept-Language
header.
If the client request doesn't provide an Accept-Language header,
this method returns an Enumeration containing one
Locale , the default locale for the server.
an Enumeration of preferredLocale objects for the client |
getMethod | String getMethod()(Code) | | Returns the name of the HTTP method with which this
request was made, for example, GET, POST, or PUT.
Same as the value of the CGI variable REQUEST_METHOD.
a String specifying the nameof the method with whichthis request was made |
getParameter | String getParameter(String name)(Code) | | Returns the value of a request parameter as a String ,
Parameters: name - a String specifying thename of the parameter a String representing thesingle value of the parameter See Also: Request.getParameterValues(String) |
getParameterNames | Enumeration getParameterNames()(Code) | | Returns an Enumeration of String
objects containing the names of the parameters contained
in this request. If the request has
no parameters, the method returns an
empty Enumeration .
an Enumeration of String objects, each String containingthe name of a request parameter; or anempty Enumeration if therequest has no parameters |
getParameterValues | String[] getParameterValues(String name)(Code) | | Returns an array of String objects containing
all of the values the given request parameter has, or
null if the parameter does not exist.
If the parameter has a single value, the array has a length
of 1.
Parameters: name - a String containing the name ofthe parameter whose value is requested an array of String objectscontaining the parameter's values See Also: Request.getParameter(String) |
getPathInfo | String getPathInfo()(Code) | | Returns any extra path information associated with
the URL the client sent when it made this request.
The extra path information follows the servlet path
but precedes the query string.
This method returns null if there
was no extra path information.
Same as the value of the CGI variable PATH_INFO.
a String specifyingextra path information that comesafter the servlet path but beforethe query string in the request URL;or null if the URL does not haveany extra path information |
getPathTranslated | String getPathTranslated()(Code) | | Returns any extra path information after the servlet name
but before the query string, and translates it to a real
path. Same as the value of the CGI variable PATH_TRANSLATED.
If the URL does not have any extra path information,
this method returns null .
a String specifying thereal path, or null ifthe URL does not have any extra pathinformation |
getProtocol | String getProtocol()(Code) | | Returns the name and version of the protocol the request uses
in the form protocol/majorVersion.minorVersion, for
example, HTTP/1.1. For HTTP servlets, the value
returned is the same as the value of the CGI variable
SERVER_PROTOCOL .
a String containing the protocolname and version number |
getQueryString | String getQueryString()(Code) | | Returns the query string that is contained in the request
URL after the path. This method returns null
if the URL does not have a query string. Same as the value
of the CGI variable QUERY_STRING.
a String containing the querystring or null if the URLcontains no query string |
getRemoteAddr | String getRemoteAddr()(Code) | | Returns the Internet Protocol (IP) address of the client
that sent the request. For HTTP servlets, same as the value of the
CGI variable REMOTE_ADDR .
a String containing theIP address of the client that sent the request |
getRemoteHost | String getRemoteHost()(Code) | | Returns the fully qualified name of the client that sent the
request, or the IP address of the client if the name cannot be
determined. For HTTP servlets, same as the value of the CGI variable
REMOTE_HOST .
a String containing the fully qualified nameof the client |
getRemoteUser | String getRemoteUser()(Code) | | Returns the login of the user making this request, if the
user has been authenticated, or null if the user
has not been authenticated.
Whether the user name is sent with each subsequent request
depends on the browser and type of authentication. Same as the
value of the CGI variable REMOTE_USER.
a String specifying the loginof the user making this request, or null |
getRequestURI | String getRequestURI()(Code) | | Returns the part of this request's URL from the protocol
name up to the query string in the first line of the HTTP request.
For example:
First line of HTTP request |
| Returned Value
|
---|
POST /some/path.html HTTP/1.1 | | /some/path.html
| GET http://foo.bar/a.html HTTP/1.0
| | http://foo.bar/a.html
| HEAD /xyz?a=b HTTP/1.1 | | /xyz
|
a String containingthe part of the URL from theprotocol name up to the query string |
getRequestedSessionId | String getRequestedSessionId()(Code) | | Returns the session ID specified by the client. This may
not be the same as the ID of the actual session in use.
For example, if the request specified an old (expired)
session ID and the server has started a new session, this
method gets a new session with a new ID. If the request
did not specify a session ID, this method returns
null .
a String specifying the sessionID, or null if the request didnot specify a session ID See Also: Request.isRequestedSessionIdValid() |
getScheme | String getScheme()(Code) | | Returns the name of the scheme used to make this request,
for example,
http , https , or ftp .
Different schemes have different rules for constructing URLs,
as noted in RFC 1738.
a String containing the nameof the scheme used to make this request |
getServerName | String getServerName()(Code) | | Returns the host name of the server that received the request.
For HTTP servlets, same as the value of the CGI variable
SERVER_NAME .
a String containing the nameof the server to which the request was sent |
getServerPort | int getServerPort()(Code) | | Returns the port number on which this request was received.
For HTTP servlets, same as the value of the CGI variable
SERVER_PORT .
an integer specifying the port number |
getServletPath | String getServletPath()(Code) | | Returns the part of this request's URL that calls
the servlet. This includes either the servlet name or
a path to the servlet, but does not include any extra
path information or a query string. Same as the value
of the CGI variable SCRIPT_NAME.
a String containingthe name or path of the servlet beingcalled, as specified in the request URL |
getSession | Session getSession(boolean create)(Code) | | Returns the current Session
associated with this request or, if if there is no
current session and create is true, returns
a new session.
If create is false
and the request has no valid Session ,
this method returns null .
To make sure the session is properly maintained,
you must call this method before
the response is committed.
Parameters: create - true to createa new session for this request if necessary;false to return null if there's no current session the Session associatedwith this request or null ifcreate is false and the request has no valid session See Also: Request.getSession() |
getSession | Session getSession()(Code) | | Returns the current session associated with this request,
or if the request does not have a session, creates one.
the Session associatedwith this request See Also: Request.getSession(boolean) |
getSitemapURI | String getSitemapURI()(Code) | |
Returns the URI of the requested resource as interpreted by the sitemap.
For example, if your webapp is mounted at "/webapp" and the HTTP request
is for "/webapp/foo", this method returns "foo". Consequently, if the
request is for "/webapp", this method returns an empty string.
Note that if the request is mapped to a pipeline that contains
aggregated content, and if this method is called in the context of
one of the aggregated parts (e.g. a server page), this method will
return the URI of the aggregated part, not the original requested URI.
a String containing the URL as mangled by thesitemap |
getSitemapURIPrefix | String getSitemapURIPrefix()(Code) | |
Returns the URI Prefix of the requested resource where the sitemap is mounted.
For example, if your webapp is mounted at "/webapp" and the HTTP request
is for "/webapp/foo", this method returns "webapp/".
a String containing the URI prefix as mangled by thesitemap |
getUserPrincipal | Principal getUserPrincipal()(Code) | | Returns the login of the user making this request, if the
user has been authenticated, or null if the user
has not been authenticated.
Whether the user name is sent with each subsequent request
depends on the browser and type of authentication. Same as the
value of the CGI variable REMOTE_USER.
a String specifying the loginof the user making this request, or null |
isRequestedSessionIdFromCookie | boolean isRequestedSessionIdFromCookie()(Code) | | Checks whether the requested session ID came in as a cookie.
true if the session IDcame in as acookie; otherwise, false See Also: Request.getSession() |
isRequestedSessionIdFromURL | boolean isRequestedSessionIdFromURL()(Code) | | Checks whether the requested session ID came in as part of the
request URL.
true if the session IDcame in as part of a URL; otherwise,false See Also: Request.getSession() |
isRequestedSessionIdValid | boolean isRequestedSessionIdValid()(Code) | | Checks whether the requested session ID is still valid.
true if thisrequest has an id for a valid sessionin the current session context;false otherwise See Also: Request.getRequestedSessionId() See Also: Request.getSession() |
isSecure | boolean isSecure()(Code) | | Returns a boolean indicating whether this request was made using a
secure channel, such as HTTPS.
a boolean indicating if the request was made using asecure channel |
isUserInRole | boolean isUserInRole(String role)(Code) | | Checks whether the currently logged in user is in a specified role.
true if the user isauthenticated and in the role;otherwise, false See Also: Request.getRemoteUser() |
removeAttribute | void removeAttribute(String name)(Code) | | Removes an attribute from this request. This method is not
generally needed as attributes only persist as long as the request
is being handled.
Attribute names should follow the same conventions as
package names. Names beginning with java.* ,
javax.* , and com.sun.* , are
reserved for use by Sun Microsystems.
Parameters: name - a String specifyingthe name of the attribute to remove |
setAttribute | void setAttribute(String name, Object o)(Code) | | Stores an attribute in this request.
Attributes are reset between requests.
Attribute names should follow the same conventions as
package names. Names beginning with java.* ,
javax.* , and com.sun.* , are
reserved for use by Sun Microsystems.
Parameters: name - a String specifyingthe name of the attribute Parameters: o - the Object to be stored |
|
|