org.apache.cocoon.environment.background
Class BackgroundRequest

java.lang.Object
  extended byorg.apache.cocoon.environment.impl.AbstractRequest
      extended byorg.apache.cocoon.environment.background.BackgroundRequest
All Implemented Interfaces:
HttpServletRequest, org.apache.cocoon.environment.Request, ServletRequest, org.apache.cocoon.environment.ValueHolder

public class BackgroundRequest
extends org.apache.cocoon.environment.impl.AbstractRequest

Creates a specific servlet request simulation from command line usage.

Version:
$Id: BackgroundRequest.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
 
Fields inherited from interface org.apache.cocoon.environment.Request
GLOBAL_SCOPE, REQUEST_SCOPE
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
BackgroundRequest(org.apache.cocoon.environment.Environment env, String contextPath, String servletPath, String pathInfo)
           
BackgroundRequest(org.apache.cocoon.environment.Environment env, String contextPath, String servletPath, String pathInfo, Map attributes)
           
BackgroundRequest(org.apache.cocoon.environment.Environment env, String contextPath, String servletPath, String pathInfo, Map attributes, Map parameters)
           
BackgroundRequest(org.apache.cocoon.environment.Environment env, String contextPath, String servletPath, String pathInfo, Map attributes, Map parameters, Map headers)
           
 
Method Summary
 Object get(String name)
           
 Object getAttribute(String name)
           
 Enumeration getAttributeNames()
           
 String getAuthType()
           
 String getCharacterEncoding()
           
 Map getCocoonCookieMap()
           
 org.apache.cocoon.environment.Cookie[] getCocoonCookies()
           
 org.apache.cocoon.environment.Session getCocoonSession()
           
 org.apache.cocoon.environment.Session getCocoonSession(boolean create)
           
 int getContentLength()
           
 String getContentType()
           
 String getContextPath()
           
 Map getCookieMap()
           
 Cookie[] getCookies()
           
 long getDateHeader(String name)
           
 String getHeader(String name)
           
 Enumeration getHeaderNames()
           
 Enumeration getHeaders(String name)
           
 ServletInputStream getInputStream()
           
 int getIntHeader(String name)
           
 Object getLocalAttribute(String name)
           
 Enumeration getLocalAttributeNames()
           
 Locale getLocale()
           
 Enumeration getLocales()
           
 String getMethod()
           
 String getParameter(String name)
           
 Map getParameterMap()
           
 Enumeration getParameterNames()
           
 String[] getParameterValues(String name)
           
 String getPathInfo()
           
 String getPathTranslated()
           
 String getProtocol()
           
 String getQueryString()
           
 String getRemoteAddr()
           
 String getRemoteHost()
           
 String getRemoteUser()
           
 String getRequestedSessionId()
          Returns the session ID specified by the client.
 String getRequestURI()
           
 StringBuffer getRequestURL()
           
 String getScheme()
           
 String getServerName()
           
 int getServerPort()
           
 String getServletPath()
           
 HttpSession getSession()
          Returns the current session associated with this request, or if the request does not have a session, creates one.
 HttpSession 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.
 String getSitemapPath()
           
 String getSitemapURI()
           
 String getSitemapURIPrefix()
           
 Principal getUserPrincipal()
           
 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()
           
 boolean isUserInRole(String role)
           
 void removeAttribute(String name)
           
 void removeLocalAttribute(String name)
           
 Object searchAttribute(String name)
           
 void setAttribute(String name, Object value)
           
 void setCharacterEncoding(String env)
           
 void setLocalAttribute(String name, Object value)
           
 
Methods inherited from class org.apache.cocoon.environment.impl.AbstractRequest
getAttributes, getHeaders, getLocalAddr, getLocalName, getLocalPort, getParameters, getReader, getRealPath, getRemotePort, getRequestDispatcher, isRequestedSessionIdFromUrl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BackgroundRequest

public BackgroundRequest(org.apache.cocoon.environment.Environment env,
                         String contextPath,
                         String servletPath,
                         String pathInfo)

BackgroundRequest

public BackgroundRequest(org.apache.cocoon.environment.Environment env,
                         String contextPath,
                         String servletPath,
                         String pathInfo,
                         Map attributes)

BackgroundRequest

public BackgroundRequest(org.apache.cocoon.environment.Environment env,
                         String contextPath,
                         String servletPath,
                         String pathInfo,
                         Map attributes,
                         Map parameters)

BackgroundRequest

public BackgroundRequest(org.apache.cocoon.environment.Environment env,
                         String contextPath,
                         String servletPath,
                         String pathInfo,
                         Map attributes,
                         Map parameters,
                         Map headers)
Method Detail

get

public Object get(String name)

getContextPath

public String getContextPath()

getServletPath

public String getServletPath()

getPathInfo

public String getPathInfo()

getRequestURI

public String getRequestURI()

getSitemapURI

public String getSitemapURI()

getSitemapURIPrefix

public String getSitemapURIPrefix()

getSitemapPath

public String getSitemapPath()

getQueryString

public String getQueryString()

getPathTranslated

public String getPathTranslated()

getAttribute

public Object getAttribute(String name)

getAttributeNames

public Enumeration getAttributeNames()

setAttribute

public void setAttribute(String name,
                         Object value)

removeAttribute

public void removeAttribute(String name)

getLocalAttribute

public Object getLocalAttribute(String name)

getLocalAttributeNames

public Enumeration getLocalAttributeNames()

setLocalAttribute

public void setLocalAttribute(String name,
                              Object value)

removeLocalAttribute

public void removeLocalAttribute(String name)

getParameter

public String getParameter(String name)

getParameterNames

public Enumeration getParameterNames()

getParameterValues

public String[] getParameterValues(String name)

getHeader

public String getHeader(String name)

getIntHeader

public int getIntHeader(String name)

getDateHeader

public long getDateHeader(String name)

getHeaders

public Enumeration getHeaders(String name)

getHeaderNames

public Enumeration getHeaderNames()

getCharacterEncoding

public String getCharacterEncoding()

getContentLength

public int getContentLength()

getContentType

public String getContentType()

getProtocol

public String getProtocol()

getScheme

public String getScheme()

getServerName

public String getServerName()

getServerPort

public int getServerPort()

getRemoteAddr

public String getRemoteAddr()

getRemoteHost

public String getRemoteHost()

getMethod

public String getMethod()

getRemoteUser

public String getRemoteUser()

getCookies

public Cookie[] getCookies()

getCookieMap

public Map getCookieMap()

getCocoonCookies

public org.apache.cocoon.environment.Cookie[] getCocoonCookies()

getCocoonCookieMap

public Map getCocoonCookieMap()

getSession

public HttpSession getSession()
Returns the current session associated with this request, or if the request does not have a session, creates one.

Returns:
the Session associated with this request
See Also:
getSession(boolean)

getSession

public HttpSession 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.

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 create a new session for this request if necessary; false to return null if there's no current session
Returns:
the Session associated with this request or null if create is false and the request has no valid session
See Also:
getSession()

getCocoonSession

public org.apache.cocoon.environment.Session getCocoonSession(boolean create)

getCocoonSession

public org.apache.cocoon.environment.Session getCocoonSession()

getRequestedSessionId

public String getRequestedSessionId()
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.

Returns:
a String specifying the session ID, or null if the request did not specify a session ID
See Also:
isRequestedSessionIdValid()

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Checks whether the requested session ID is still valid.

Returns:
true if this request has an id for a valid session in the current session context; false otherwise
See Also:
getRequestedSessionId(), getSession()

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
Checks whether the requested session ID came in as a cookie.

Returns:
true if the session ID came in as a cookie; otherwise, false
See Also:
getSession()

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Checks whether the requested session ID came in as part of the request URL.

Returns:
true if the session ID came in as part of a URL; otherwise, false
See Also:
getSession()

getLocale

public Locale getLocale()

getLocales

public Enumeration getLocales()

getAuthType

public String getAuthType()

isSecure

public boolean isSecure()

isUserInRole

public boolean isUserInRole(String role)

getUserPrincipal

public Principal getUserPrincipal()

getParameterMap

public Map getParameterMap()

setCharacterEncoding

public void setCharacterEncoding(String env)
                          throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

getRequestURL

public StringBuffer getRequestURL()

getInputStream

public ServletInputStream getInputStream()
                                  throws UnsupportedOperationException
Throws:
UnsupportedOperationException

searchAttribute

public Object searchAttribute(String name)
See Also:
Request.searchAttribute(java.lang.String)


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.