com.caucho.server.http
Class RequestAdapter

java.lang.Object
  extended by com.caucho.server.http.RequestWrapper
      extended by com.caucho.server.http.RequestAdapter
All Implemented Interfaces:
CauchoRequest, HttpServletRequest, ServletRequest
Direct Known Subclasses:
SetRequestSecureFilterChain.SecureServletRequestWrapper

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 JSP_EXCEPTION
           
static java.lang.String SHUTDOWN
           
 
Fields inherited from class com.caucho.server.http.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 authenticate(HttpServletResponse response)
           
 void clientDisconnect()
           
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.
 AbstractHttpRequest getAbstractHttpRequest()
           
 CauchoRequest getCauchoRequest()
           
 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)
           
 Part getPart(java.lang.String name)
           
 java.util.Collection<Part> getParts()
           
 int getRequestDepth(int depth)
           
 java.lang.String getRequestedSessionId()
          Returns the session id.
protected  HttpServletResponse getResponse()
           
 HttpSession getSession(boolean create)
          Returns a session.
 java.lang.String getSessionId()
           
protected  SessionManager getSessionManager()
           
 SocketLink getSocketLink()
           
 ReadStream getStream()
          Returns the underlying read stream.
 boolean getVaryCookies()
           
 WebApp getWebApp()
           
 boolean hasRequest()
           
 void init(HttpServletRequest request, HttpServletResponse response, WebApp app)
           
 boolean isComet()
           
 boolean isConnectionClosed()
           
 boolean isDuplex()
           
 boolean isLoginRequested()
           
 boolean isMultipartEnabled()
           
 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 isSessionIdFromCookie()
           
 boolean isSuspend()
           
 boolean isSyntheticCacheHeader()
           
 boolean isTop()
           
 boolean isUserInRole(java.lang.String role)
          Checks the isUserInRole.
 void killKeepalive(java.lang.String reason)
           
 boolean login(boolean isFail)
           
 void login(java.lang.String username, java.lang.String password)
           
 void logout()
           
 void requestLogin()
           
 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 setSessionId(java.lang.String sessionId)
           
 void setSyntheticCacheHeader(boolean isSynthetic)
           
 void setVaryCookie(java.lang.String cookie)
           
 void setWebApp(WebApp app)
           
 java.lang.String toString()
           
 
Methods inherited from class com.caucho.server.http.RequestWrapper
addAsyncListener, addAsyncListener, complete, getAsyncContext, getAttribute, getAttributeNames, getAuthType, getCharacterEncoding, getContentLength, getContentType, getContextPath, getDateHeader, getDispatcherType, 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, getServletContext, getServletPath, getServletResponse, getSession, getUserPrincipal, isAsyncStarted, isAsyncSupported, isInitial, isRequestedSessionIdFromUrl, isResumed, isSecure, isSuspended, isTimeout, removeAttribute, resume, setAttribute, setCharacterEncoding, setRequest, startAsync, startAsync, suspend, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.caucho.server.http.CauchoRequest
getServletResponse
 
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
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
 

Field Detail

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)

getAbstractHttpRequest

public AbstractHttpRequest getAbstractHttpRequest()
Specified by:
getAbstractHttpRequest in interface CauchoRequest

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

setSyntheticCacheHeader

public void setSyntheticCacheHeader(boolean isSynthetic)
Specified by:
setSyntheticCacheHeader in interface CauchoRequest

isSyntheticCacheHeader

public boolean isSyntheticCacheHeader()
Specified by:
isSyntheticCacheHeader 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

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

isSessionIdFromCookie

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

getSessionId

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

setSessionId

public void setSessionId(java.lang.String sessionId)
Specified by:
setSessionId in interface CauchoRequest

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

isComet

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

isDuplex

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

killKeepalive

public void killKeepalive(java.lang.String reason)
Specified by:
killKeepalive in interface CauchoRequest

getSocketLink

public SocketLink getSocketLink()
Specified by:
getSocketLink in interface CauchoRequest

isConnectionClosed

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

clientDisconnect

public void clientDisconnect()

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

isLoginRequested

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

requestLogin

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

login

public boolean login(boolean isFail)
Specified by:
login in interface CauchoRequest

isSuspend

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

hasRequest

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

authenticate

public boolean authenticate(HttpServletResponse response)
                     throws java.io.IOException,
                            ServletException
Specified by:
authenticate in interface HttpServletRequest
Throws:
java.io.IOException
ServletException
Since:
Servlet 3.0

getPart

public Part getPart(java.lang.String name)
             throws java.io.IOException,
                    ServletException
Specified by:
getPart in interface HttpServletRequest
Throws:
java.io.IOException
ServletException
Since:
Servlet 3.0

getParts

public java.util.Collection<Part> getParts()
                                    throws java.io.IOException,
                                           ServletException
Specified by:
getParts in interface HttpServletRequest
Throws:
java.io.IOException
ServletException
Since:
Servlet 3.0

isMultipartEnabled

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

login

public void login(java.lang.String username,
                  java.lang.String password)
           throws ServletException
Specified by:
login in interface HttpServletRequest
Throws:
ServletException
Since:
Servlet 3.0

logout

public void logout()
            throws ServletException
Specified by:
logout in interface HttpServletRequest
Throws:
ServletException
Since:
Servlet 3.0

getCauchoRequest

public CauchoRequest getCauchoRequest()

free

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


free

protected void free()
Clears the adapter.

Overrides:
free in class RequestWrapper

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object