com.caucho.server.connection
Class RequestAdapter

java.lang.Object
  extended by com.caucho.server.connection.RequestWrapper
      extended by com.caucho.server.connection.RequestAdapter
All Implemented Interfaces:
CauchoRequest, HttpServletRequest, ServletRequest

public class RequestAdapter
extends RequestWrapper
implements CauchoRequest

Any requests that depends on an underlying request, like include() requests or adapters for other servlet engines.


Field Summary
static java.lang.String CONTEXT_PATH
           
static java.lang.String ERROR_URI
           
static java.lang.String EXCEPTION
           
static java.lang.String EXCEPTION_TYPE
           
static java.lang.String JSP_EXCEPTION
           
static java.lang.String MESSAGE
           
static java.lang.String PATH_INFO
           
static java.lang.String QUERY_STRING
           
static java.lang.String REQUEST_URI
           
static java.lang.String SERVLET_NAME
           
static java.lang.String SERVLET_PATH
           
static java.lang.String SHUTDOWN
           
static java.lang.String STATUS_CODE
           
 
Fields inherited from class com.caucho.server.connection.RequestWrapper
_request
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
protected RequestAdapter()
           
protected RequestAdapter(HttpServletRequest request, WebApp app)
           
 
Method Summary
 boolean allowKeepalive()
           
 boolean authenticate()
           
static RequestAdapter create()
          Creates a new RequestAdapter.
static RequestAdapter create(HttpServletRequest request, WebApp app)
          Creates a new RequestAdapter.
protected  void free()
          Clears the adapter.
static void free(RequestAdapter reqAdapt)
          Frees the adapter for reuse.
 Cookie getCookie(java.lang.String name)
           
protected  java.lang.String getCookieName(SessionManager manager)
           
 Cookie[] getCookies()
          Returns an array of all cookies sent by the client.
 boolean getHasCookie()
           
 HttpSession getMemorySession()
           
 java.lang.String getPageContextPath()
           
static java.lang.String getPageContextPath(HttpServletRequest request)
           
 java.lang.String getPagePathInfo()
          Returns the path-info for the current page, i.e.
static java.lang.String getPagePathInfo(HttpServletRequest request)
          Returns the path-info for the current page, i.e.
 java.lang.String getPageQueryString()
          Returns the query-string for the current page, i.e.
static java.lang.String getPageQueryString(HttpServletRequest request)
          Returns the query-string for the current page, i.e.
 java.lang.String getPageServletPath()
          Returns the servlet-path for the current page, i.e.
static java.lang.String getPageServletPath(HttpServletRequest request)
          Returns the servlet-path for the current page, i.e.
 java.lang.String getPageURI()
          Returns the URI for the current page: included or top-level.
static java.lang.String getPageURI(HttpServletRequest request)
           
 int getRequestDepth(int depth)
           
 java.lang.String getRequestedSessionId()
          Returns the session id.
protected  HttpServletResponse getResponse()
           
 HttpSession getSession(boolean create)
          Returns a session.
protected  SessionManager getSessionManager()
           
 ReadStream getStream()
          Returns the underlying read stream.
 java.lang.String getVaryCookie()
           
 boolean getVaryCookies()
           
 WebApp getWebApp()
           
 void init(HttpServletRequest request, HttpServletResponse response, WebApp app)
           
 boolean isRequestedSessionIdFromCookie()
          Returns true if the session came from a cookie.
 boolean isRequestedSessionIdFromURL()
          Returns true if the session came URL-encoding.
 boolean isRequestedSessionIdValid()
          Returns true if the session is valid.
 boolean isTop()
           
 boolean isUserInRole(java.lang.String role)
          Checks the isUserInRole.
 void killKeepalive()
           
 void setHasCookie()
           
 void setHeader(java.lang.String key, java.lang.String value)
           
 void setResponse(CauchoResponse response)
           
 java.util.HashMap<java.lang.String,java.lang.String> setRoleMap(java.util.HashMap<java.lang.String,java.lang.String> map)
          Sets the role map.
 void setVaryCookie(java.lang.String cookie)
           
 void setWebApp(WebApp app)
           
 
Methods inherited from class com.caucho.server.connection.RequestWrapper
getAttribute, getAttributeNames, getAuthType, getCharacterEncoding, getContentLength, getContentType, getContextPath, getDateHeader, getHeader, getHeaderNames, getHeaders, getInputStream, getIntHeader, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getMethod, getParameter, getParameterMap, getParameterNames, getParameterValues, getPathInfo, getPathTranslated, getProtocol, getQueryString, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRemoteUser, getRequest, getRequestDispatcher, getRequestURI, getRequestURL, getScheme, getServerName, getServerPort, getServletPath, getSession, getUserPrincipal, isRequestedSessionIdFromUrl, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.http.HttpServletRequest
getAuthType, getContextPath, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestURI, getRequestURL, getServletPath, getSession, getUserPrincipal, isRequestedSessionIdFromUrl
 
Methods inherited from interface javax.servlet.ServletRequest
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding
 

Field Detail

REQUEST_URI

public static java.lang.String REQUEST_URI

CONTEXT_PATH

public static java.lang.String CONTEXT_PATH

SERVLET_PATH

public static java.lang.String SERVLET_PATH

PATH_INFO

public static java.lang.String PATH_INFO

QUERY_STRING

public static java.lang.String QUERY_STRING

STATUS_CODE

public static java.lang.String STATUS_CODE

EXCEPTION_TYPE

public static java.lang.String EXCEPTION_TYPE

MESSAGE

public static java.lang.String MESSAGE

EXCEPTION

public static java.lang.String EXCEPTION

ERROR_URI

public static java.lang.String ERROR_URI

SERVLET_NAME

public static java.lang.String SERVLET_NAME

JSP_EXCEPTION

public static java.lang.String JSP_EXCEPTION

SHUTDOWN

public static java.lang.String SHUTDOWN
Constructor Detail

RequestAdapter

protected RequestAdapter()

RequestAdapter

protected RequestAdapter(HttpServletRequest request,
                         WebApp app)
Method Detail

create

public static RequestAdapter create(HttpServletRequest request,
                                    WebApp app)
Creates a new RequestAdapter.


create

public static RequestAdapter create()
Creates a new RequestAdapter.


init

public void init(HttpServletRequest request,
                 HttpServletResponse response,
                 WebApp app)
          throws ServletException
Throws:
ServletException

isTop

public boolean isTop()
Specified by:
isTop in interface CauchoRequest

setWebApp

public void setWebApp(WebApp app)

getResponse

protected HttpServletResponse getResponse()

setResponse

public void setResponse(CauchoResponse response)

getStream

public ReadStream getStream()
                     throws java.io.IOException
Returns the underlying read stream.

Specified by:
getStream in interface CauchoRequest
Throws:
java.io.IOException

getPageURI

public java.lang.String getPageURI()
Returns the URI for the current page: included or top-level.

Specified by:
getPageURI in interface CauchoRequest

getPageURI

public static java.lang.String getPageURI(HttpServletRequest request)

getPageContextPath

public java.lang.String getPageContextPath()
Specified by:
getPageContextPath in interface CauchoRequest

getPageContextPath

public static java.lang.String getPageContextPath(HttpServletRequest request)

getPageServletPath

public java.lang.String getPageServletPath()
Returns the servlet-path for the current page, i.e. this will return the url of the include page, not the original request.

Specified by:
getPageServletPath in interface CauchoRequest

getPageServletPath

public static java.lang.String getPageServletPath(HttpServletRequest request)
Returns the servlet-path for the current page, i.e. this will return the url of the include page, not the original request.


getPagePathInfo

public java.lang.String getPagePathInfo()
Returns the path-info for the current page, i.e. this will return the url of the include page, not the original request.

Specified by:
getPagePathInfo in interface CauchoRequest

getPagePathInfo

public static java.lang.String getPagePathInfo(HttpServletRequest request)
Returns the path-info for the current page, i.e. this will return the url of the include page, not the original request.


getPageQueryString

public java.lang.String getPageQueryString()
Returns the query-string for the current page, i.e. this will return the url of the include page, not the original request.

Specified by:
getPageQueryString in interface CauchoRequest

getPageQueryString

public static java.lang.String getPageQueryString(HttpServletRequest request)
Returns the query-string for the current page, i.e. this will return the url of the include page, not the original request.


getRequestDepth

public int getRequestDepth(int depth)
Specified by:
getRequestDepth in interface CauchoRequest

setHeader

public void setHeader(java.lang.String key,
                      java.lang.String value)
Specified by:
setHeader in interface CauchoRequest

getWebApp

public WebApp getWebApp()
Specified by:
getWebApp in interface CauchoRequest

setVaryCookie

public void setVaryCookie(java.lang.String cookie)
Specified by:
setVaryCookie in interface CauchoRequest

getVaryCookie

public java.lang.String getVaryCookie()
Specified by:
getVaryCookie in interface CauchoRequest

getVaryCookies

public boolean getVaryCookies()
Specified by:
getVaryCookies in interface CauchoRequest

setHasCookie

public void setHasCookie()
Specified by:
setHasCookie in interface CauchoRequest

getHasCookie

public boolean getHasCookie()
Specified by:
getHasCookie in interface CauchoRequest

getMemorySession

public HttpSession getMemorySession()
Specified by:
getMemorySession in interface CauchoRequest

getSession

public HttpSession getSession(boolean create)
Description copied from class: RequestWrapper
Returns a session. If no session exists and create is true, then create a new session, otherwise return null.

Specified by:
getSession in interface HttpServletRequest
Overrides:
getSession in class RequestWrapper
Parameters:
create - If true, then create a new session if none exists.

getRequestedSessionId

public java.lang.String getRequestedSessionId()
Description copied from class: RequestWrapper
Returns the session id. Sessions are a convenience for keeping user state across requests.

The session id is the value of the JSESSION cookie.

Specified by:
getRequestedSessionId in interface HttpServletRequest
Overrides:
getRequestedSessionId in class RequestWrapper

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Description copied from class: RequestWrapper
Returns true if the session is valid.

Specified by:
isRequestedSessionIdValid in interface HttpServletRequest
Overrides:
isRequestedSessionIdValid in class RequestWrapper

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
Description copied from class: RequestWrapper
Returns true if the session came from a cookie.

Specified by:
isRequestedSessionIdFromCookie in interface HttpServletRequest
Overrides:
isRequestedSessionIdFromCookie in class RequestWrapper

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Description copied from class: RequestWrapper
Returns true if the session came URL-encoding.

Specified by:
isRequestedSessionIdFromURL in interface HttpServletRequest
Overrides:
isRequestedSessionIdFromURL in class RequestWrapper

getSessionManager

protected final SessionManager getSessionManager()

getCookieName

protected final java.lang.String getCookieName(SessionManager manager)

getCookies

public Cookie[] getCookies()
Description copied from class: RequestWrapper
Returns an array of all cookies sent by the client.

Specified by:
getCookies in interface HttpServletRequest
Overrides:
getCookies in class RequestWrapper

getCookie

public Cookie getCookie(java.lang.String name)
Specified by:
getCookie in interface CauchoRequest

killKeepalive

public void killKeepalive()
Specified by:
killKeepalive in interface CauchoRequest

allowKeepalive

public boolean allowKeepalive()
Specified by:
allowKeepalive in interface CauchoRequest

setRoleMap

public java.util.HashMap<java.lang.String,java.lang.String> setRoleMap(java.util.HashMap<java.lang.String,java.lang.String> map)
Sets the role map.


isUserInRole

public boolean isUserInRole(java.lang.String role)
Checks the isUserInRole.

Specified by:
isUserInRole in interface HttpServletRequest
Overrides:
isUserInRole in class RequestWrapper

authenticate

public boolean authenticate()
                     throws ServletException,
                            java.io.IOException
Specified by:
authenticate in interface CauchoRequest
Throws:
ServletException
java.io.IOException

free

public static void free(RequestAdapter reqAdapt)
Frees the adapter for reuse.


free

protected void free()
Clears the adapter.

Overrides:
free in class RequestWrapper