org.apache.cocoon.environment.wrapper
Class RequestWrapper

java.lang.Object
  extended byorg.apache.cocoon.environment.impl.AbstractRequest
      extended byorg.apache.cocoon.environment.wrapper.AbstractRequestWrapper
          extended byorg.apache.cocoon.environment.wrapper.RequestWrapper
All Implemented Interfaces:
Request

public final class RequestWrapper
extends AbstractRequestWrapper

This is a wrapper class for the Request object. It has the same properties except that the url and the parameters are different.

Version:
$Id: RequestWrapper.java 202268 2005-06-28 19:03:15Z vgritsenko $
Author:
Carsten Ziegeler

Field Summary
 
Fields inherited from class org.apache.cocoon.environment.wrapper.AbstractRequestWrapper
req
 
Fields inherited from interface org.apache.cocoon.environment.Request
GLOBAL_SCOPE, REQUEST_SCOPE
 
Constructor Summary
RequestWrapper(Request request, String requestURI, String queryString, Environment env)
          Constructor
RequestWrapper(Request request, String requestURI, String queryString, Environment env, boolean rawMode)
          Constructor
 
Method Summary
 Object getAttribute(String name, int scope)
          Returns the value of the named attribute from the scope as an Object, or null if no attribute of the given name exists.
 Enumeration getAttributeNames(int scope)
          Returns an Enumeration containing the names of the attributes available to this request in the scope.
 String getParameter(String name)
          Returns the value of a request parameter as a String,
 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 getQueryString()
          Returns the query string that is contained in the request URL after the path.
 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 getSitemapPath()
           Returns the path to the sitemap of the requested resource as interpreted by the sitemap.
 String getSitemapURI()
           Returns the URI of the requested resource as interpreted by the sitemap.
 String getSitemapURIPrefix()
           Returns the URI Prefix of the requested resource where the sitemap is mounted.
 void removeAttribute(String name, int scope)
          Removes an attribute from this request in the scope.
 Object searchAttribute(String name)
          Returns the value of the named attribute searching both scopes as an Object, or null if no attribute of the given name exists.
 void setAttribute(String name, Object o, int scope)
          Stores an attribute in this request in the scope.
 void setRequestURI(String prefix, String uri)
           
 
Methods inherited from class org.apache.cocoon.environment.wrapper.AbstractRequestWrapper
get, getAttribute, getAttributeNames, getAuthType, getCharacterEncoding, getContentLength, getContentType, getContextPath, getCookieMap, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getInputStream, getLocale, getLocales, getMethod, getPathInfo, getPathTranslated, getProtocol, getRemoteAddr, getRemoteHost, getRemoteUser, getRequestedSessionId, getScheme, getServerName, getServerPort, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isSecure, isUserInRole, removeAttribute, setAttribute, setCharacterEncoding
 
Methods inherited from class org.apache.cocoon.environment.impl.AbstractRequest
getAttributes, getHeaders, getParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestWrapper

public RequestWrapper(Request request,
                      String requestURI,
                      String queryString,
                      Environment env)
Constructor


RequestWrapper

public RequestWrapper(Request request,
                      String requestURI,
                      String queryString,
                      Environment env,
                      boolean rawMode)
Constructor

Method Detail

getParameter

public String getParameter(String name)
Description copied from interface: Request
Returns the value of a request parameter as a String,

Specified by:
getParameter in interface Request
Overrides:
getParameter in class AbstractRequestWrapper

getParameterNames

public Enumeration getParameterNames()
Description copied from interface: Request
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.

Specified by:
getParameterNames in interface Request
Overrides:
getParameterNames in class AbstractRequestWrapper

getParameterValues

public String[] getParameterValues(String name)
Description copied from interface: Request
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.

Specified by:
getParameterValues in interface Request
Overrides:
getParameterValues in class AbstractRequestWrapper

getQueryString

public String getQueryString()
Description copied from interface: Request
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.

Specified by:
getQueryString in interface Request
Overrides:
getQueryString in class AbstractRequestWrapper

getRequestURI

public String getRequestURI()
Description copied from interface: Request
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
For internal requests, this method returns the information for the original/external request!

Specified by:
getRequestURI in interface Request
Overrides:
getRequestURI in class AbstractRequestWrapper

getSitemapURI

public String getSitemapURI()
Description copied from interface: Request

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.

Specified by:
getSitemapURI in interface Request
Overrides:
getSitemapURI in class AbstractRequestWrapper

getSitemapURIPrefix

public String getSitemapURIPrefix()
Description copied from interface: Request

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/".

Specified by:
getSitemapURIPrefix in interface Request
Overrides:
getSitemapURIPrefix in class AbstractRequestWrapper
See Also:
Request.getSitemapURIPrefix()

getSitemapPath

public String getSitemapPath()
Description copied from interface: Request

Returns the path to the sitemap 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 "webapp/". Consequently, if the request is for "foo", this method returns the empty string.

Specified by:
getSitemapPath in interface Request
Overrides:
getSitemapPath in class AbstractRequestWrapper

setRequestURI

public void setRequestURI(String prefix,
                          String uri)

getAttribute

public Object getAttribute(String name,
                           int scope)
Description copied from interface: Request
Returns the value of the named attribute from the scope as an Object, or null if no attribute of the given name exists.

Specified by:
getAttribute in interface Request
Overrides:
getAttribute in class AbstractRequestWrapper

getAttributeNames

public Enumeration getAttributeNames(int scope)
Description copied from interface: Request
Returns an Enumeration containing the names of the attributes available to this request in the scope. This method returns an empty Enumeration if the request has no attributes available to it.

Specified by:
getAttributeNames in interface Request
Overrides:
getAttributeNames in class AbstractRequestWrapper

removeAttribute

public void removeAttribute(String name,
                            int scope)
Description copied from interface: Request
Removes an attribute from this request in the scope. 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.

Specified by:
removeAttribute in interface Request
Overrides:
removeAttribute in class AbstractRequestWrapper

setAttribute

public void setAttribute(String name,
                         Object o,
                         int scope)
Description copied from interface: Request
Stores an attribute in this request in the scope. 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.

Specified by:
setAttribute in interface Request
Overrides:
setAttribute in class AbstractRequestWrapper

searchAttribute

public Object searchAttribute(String name)
Description copied from interface: Request
Returns the value of the named attribute searching both scopes as an Object, or null if no attribute of the given name exists. This method first searches in the request scope and then, if no object is found, in the global scope.

Specified by:
searchAttribute in interface Request
Overrides:
searchAttribute in class AbstractRequestWrapper
See Also:
Request.searchAttribute(java.lang.String)


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.