public class CauchoRequestWrapper extends java.lang.Object implements CauchoRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH| Constructor and Description |
|---|
CauchoRequestWrapper() |
CauchoRequestWrapper(HttpServletRequest request) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
authenticate(HttpServletResponse response) |
AbstractHttpRequest |
getAbstractHttpRequest() |
AsyncContext |
getAsyncContext()
Returns the async context for the request
|
java.lang.Object |
getAttribute(java.lang.String name)
Returns an attribute value.
|
java.util.Enumeration<java.lang.String> |
getAttributeNames()
Enumerates all attribute names in the request.
|
java.lang.String |
getAuthType()
Returns the auth type, i.e.
|
java.lang.String |
getCharacterEncoding()
Returns the character encoding of the POSTed data.
|
int |
getContentLength()
Returns the content length of the data.
|
java.lang.String |
getContentType()
Returns the request's mime-type.
|
java.lang.String |
getContextPath()
Returns the part of the URI corresponding to the application's
prefix.
|
Cookie |
getCookie(java.lang.String name) |
Cookie[] |
getCookies()
Returns an array of all cookies sent by the client.
|
long |
getDateHeader(java.lang.String name)
Converts a date header to milliseconds since the epoch.
|
DispatcherType |
getDispatcherType()
Returns DispatcherType
|
boolean |
getHasCookie() |
java.lang.String |
getHeader(java.lang.String name)
Returns the first value for a request header.
|
java.util.Enumeration<java.lang.String> |
getHeaderNames()
Returns an enumeration of all headers sent by the client.
|
java.util.Enumeration<java.lang.String> |
getHeaders(java.lang.String name)
Returns all the values for a request header.
|
ServletInputStream |
getInputStream()
Returns an InputStream to retrieve POST data from the request.
|
int |
getIntHeader(java.lang.String name)
Converts a header value to an integer.
|
java.lang.String |
getLocalAddr()
This call returns the ip of the host actually used to connect to the Resin
server, which means that if ipchains, load balancing, or proxying is
involved this call does not return the correct host for
forming urls.
|
java.util.Locale |
getLocale()
Returns the request's preferred locale, based on the Accept-Language
header.
|
java.util.Enumeration<java.util.Locale> |
getLocales()
Returns an enumeration of all locales acceptable by the client.
|
java.lang.String |
getLocalName()
Returns the IP address of the local host, i.e.
|
int |
getLocalPort()
Returns the port of the local host.
|
HttpSession |
getMemorySession() |
java.lang.String |
getMethod()
Returns the HTTP method, e.g.
|
java.lang.String |
getPageContextPath() |
java.lang.String |
getPagePathInfo() |
java.lang.String |
getPageQueryString() |
java.lang.String |
getPageServletPath() |
java.lang.String |
getPageURI() |
java.lang.String |
getParameter(java.lang.String name)
Returns a form parameter.
|
java.util.Map<java.lang.String,java.lang.String[]> |
getParameterMap()
Returns a Map of the form parameters.
|
java.util.Enumeration<java.lang.String> |
getParameterNames()
Returns an enumeration of all form parameter names.
|
java.lang.String[] |
getParameterValues(java.lang.String name)
Returns all values of a form parameter.
|
Part |
getPart(java.lang.String name) |
java.util.Collection<Part> |
getParts() |
java.lang.String |
getPathInfo()
Returns the URI part after the selected servlet and null if there
is no suffix.
|
java.lang.String |
getPathTranslated()
Returns the real path of pathInfo.
|
java.lang.String |
getProtocol()
Returns the prococol, e.g.
|
java.lang.String |
getQueryString()
Returns the request's query string.
|
java.io.BufferedReader |
getReader()
Returns a reader to read POSTed data.
|
java.lang.String |
getRealPath(java.lang.String uri)
Returns the path of the URI.
|
java.lang.String |
getRemoteAddr()
Returns the IP address of the remote host, i.e.
|
java.lang.String |
getRemoteHost()
Returns the DNS hostname of the remote host, i.e.
|
int |
getRemotePort()
Returns the port of the remote host, i.e.
|
java.lang.String |
getRemoteUser()
Returns the remote user if authenticated.
|
HttpServletRequest |
getRequest() |
int |
getRequestDepth(int depth) |
RequestDispatcher |
getRequestDispatcher(java.lang.String path)
Returns a request dispatcher for later inclusion or forwarding.
|
java.lang.String |
getRequestedSessionId()
Returns the session id.
|
java.lang.String |
getRequestURI()
Returns the entire request URI
|
java.lang.StringBuffer |
getRequestURL()
Returns the URL for the request
|
CauchoResponse |
getResponse() |
java.lang.String |
getScheme()
Returns the request scheme, e.g.
|
java.lang.String |
getServerName()
Returns the server name handling the request.
|
int |
getServerPort()
Returns the server port used by the client, e.g.
|
ServletContext |
getServletContext()
Returns the servlet context for the request
|
java.lang.String |
getServletPath()
Returns the URI part corresponding to the selected servlet.
|
ServletResponse |
getServletResponse() |
HttpSession |
getSession()
Returns the current session, creating one if necessary.
|
HttpSession |
getSession(boolean create)
Returns a session.
|
java.lang.String |
getSessionId() |
SocketLink |
getSocketLink() |
ReadStream |
getStream() |
java.security.Principal |
getUserPrincipal()
Returns the equivalent principal object for the authenticated user.
|
boolean |
getVaryCookies() |
WebApp |
getWebApp() |
boolean |
hasRequest() |
boolean |
isAsyncStarted()
Returns true if the request is in async.
|
boolean |
isAsyncSupported()
Returns true if the request supports async
|
boolean |
isComet() |
boolean |
isConnectionClosed() |
boolean |
isDuplex() |
boolean |
isLoginRequested() |
boolean |
isMultipartEnabled() |
boolean |
isRequestedSessionIdFromCookie()
Returns true if the session came from a cookie.
|
boolean |
isRequestedSessionIdFromUrl() |
boolean |
isRequestedSessionIdFromURL()
Returns true if the session came URL-encoding.
|
boolean |
isRequestedSessionIdValid()
Returns true if the session is valid.
|
boolean |
isSecure()
Returns true if the connection is secure, e.g.
|
boolean |
isSessionIdFromCookie() |
boolean |
isSuspend() |
boolean |
isSyntheticCacheHeader() |
boolean |
isTop() |
boolean |
isUserInRole(java.lang.String role)
Returns true if the user is in the given role.
|
boolean |
isWrapperFor(java.lang.Class<?> wrappedType) |
boolean |
isWrapperFor(ServletRequest wrapped) |
void |
killKeepalive(java.lang.String reason) |
boolean |
login(boolean isFail) |
void |
login(java.lang.String username,
java.lang.String password) |
void |
logout() |
void |
removeAttribute(java.lang.String name)
Removes the given attribute.
|
void |
requestLogin() |
void |
setAttribute(java.lang.String name,
java.lang.Object o)
Sets an attribute value.
|
void |
setCharacterEncoding(java.lang.String encoding)
Overrides the character encoding specified in the request.
|
void |
setHasCookie() |
void |
setHeader(java.lang.String key,
java.lang.String value) |
void |
setRequest(HttpServletRequest request) |
void |
setResponse(CauchoResponse response) |
void |
setSessionId(java.lang.String sessionId) |
void |
setSyntheticCacheHeader(boolean isSynthetic) |
void |
setVaryCookie(java.lang.String cookie) |
AsyncContext |
startAsync()
Starts an async/comet mode
|
AsyncContext |
startAsync(ServletRequest servletRequest,
ServletResponse servletResponse)
Starts an async mode
|
java.lang.String |
toString() |
public CauchoRequestWrapper()
public CauchoRequestWrapper(HttpServletRequest request)
public void setRequest(HttpServletRequest request)
public HttpServletRequest getRequest()
public void setResponse(CauchoResponse response)
public CauchoResponse getResponse()
public java.lang.String getProtocol()
ServletRequestgetProtocol in interface ServletRequestpublic java.lang.String getScheme()
ServletRequestgetScheme in interface ServletRequestpublic java.lang.String getServerName()
ServletRequestgetServerName in interface ServletRequestpublic int getServerPort()
ServletRequestServletRequest.isSecure() is provided for that purpose.getServerPort in interface ServletRequestpublic java.lang.String getRemoteAddr()
ServletRequestgetRemoteAddr in interface ServletRequestpublic java.lang.String getRemoteHost()
ServletRequestgetRemoteHost in interface ServletRequestpublic int getRemotePort()
ServletRequestgetRemotePort in interface ServletRequestpublic java.lang.String getLocalAddr()
ServletRequestgetLocalAddr in interface ServletRequestpublic java.lang.String getLocalName()
ServletRequestgetLocalName in interface ServletRequestpublic int getLocalPort()
ServletRequestServletRequest.isSecure() is provided for that purpose.getLocalPort in interface ServletRequestpublic java.lang.String getParameter(java.lang.String name)
ServletRequestgetParameter returns the first.
For example, calling getParameter("a") with the
the query string a=1&a=2 will return "1".
getParameter in interface ServletRequestname - the form parameter to returnpublic java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
ServletRequestgetParameterNames
and the values are String arrays as returned by
getParameterValues.getParameterMap in interface ServletRequestpublic java.lang.String[] getParameterValues(java.lang.String name)
ServletRequestFor example, calling getParameterValues("a")
with the the query string a=1&a=2 will
return ["1", "2"].
getParameterValues in interface ServletRequestname - the form parameter to returnpublic java.util.Enumeration<java.lang.String> getParameterNames()
ServletRequest
Enumeration e = request.getParameterNames();
while (e.hasMoreElements()) {
String name = (String) e.nextElement();
out.println(name + ": " + request.getParameter(name));
}
getParameterNames in interface ServletRequestpublic ServletInputStream getInputStream() throws java.io.IOException
ServletRequestgetInputStream in interface ServletRequestjava.io.IOExceptionpublic java.io.BufferedReader getReader()
throws java.io.IOException,
java.lang.IllegalStateException
ServletRequestgetCharacterEncoding()getReader in interface ServletRequestjava.io.IOExceptionjava.lang.IllegalStateExceptionpublic java.lang.String getCharacterEncoding()
ServletRequestgetCharacterEncoding in interface ServletRequestpublic void setCharacterEncoding(java.lang.String encoding)
throws java.io.UnsupportedEncodingException
ServletRequestsetCharacterEncoding must be called before calling
getReader or reading any parameters.setCharacterEncoding in interface ServletRequestjava.io.UnsupportedEncodingExceptionpublic int getContentLength()
ServletRequestThe upshot is, rely on the input stream to end when the data completes.
getContentLength in interface ServletRequestpublic java.lang.String getContentType()
ServletRequestgetContentType in interface ServletRequestpublic java.util.Locale getLocale()
ServletRequestgetLocale in interface ServletRequestpublic java.util.Enumeration<java.util.Locale> getLocales()
ServletRequestgetLocales in interface ServletRequestpublic boolean isSecure()
ServletRequestisSecure in interface ServletRequestpublic java.lang.Object getAttribute(java.lang.String name)
ServletRequestgetAttribute in interface ServletRequestname - the attribute namepublic void setAttribute(java.lang.String name,
java.lang.Object o)
ServletRequestsetAttribute in interface ServletRequestname - the attribute nameo - the attribute valuepublic java.util.Enumeration<java.lang.String> getAttributeNames()
ServletRequestgetAttributeNames in interface ServletRequestpublic void removeAttribute(java.lang.String name)
ServletRequestremoveAttribute in interface ServletRequestname - the attribute namepublic RequestDispatcher getRequestDispatcher(java.lang.String path)
ServletRequesturi
is relative to the request URI. Absolute URIs are relative to
the application prefix (getContextPath()).
If getRequestURI() is /myapp/dir/test.jsp and the
uri is "inc.jsp", the resulting page is
/myapp/dir/inc.jsp.
RequestDispatcher disp;
disp = getRequestDispatcher("inc.jsp?a=b");
disp.include(request, response);
getRequestDispatcher in interface ServletRequestpath - path relative to getRequestURI()
(including query string) for the included file.public ServletContext getServletContext()
ServletRequestgetServletContext in interface ServletRequestpublic AsyncContext startAsync() throws java.lang.IllegalStateException
ServletRequeststartAsync in interface ServletRequestjava.lang.IllegalStateExceptionpublic AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) throws java.lang.IllegalStateException
ServletRequeststartAsync in interface ServletRequestjava.lang.IllegalStateExceptionpublic AsyncContext getAsyncContext()
ServletRequestgetAsyncContext in interface ServletRequestpublic boolean isAsyncStarted()
ServletRequestisAsyncStarted in interface ServletRequestpublic boolean isAsyncSupported()
ServletRequestisAsyncSupported in interface ServletRequestpublic boolean isWrapperFor(ServletRequest wrapped)
public boolean isWrapperFor(java.lang.Class<?> wrappedType)
public DispatcherType getDispatcherType()
ServletRequestgetDispatcherType in interface ServletRequestpublic java.lang.String getMethod()
HttpServletRequestREQUEST_METHODgetMethod in interface HttpServletRequestpublic java.lang.String getRequestURI()
HttpServletRequestgetRequestURI in interface HttpServletRequestpublic java.lang.StringBuffer getRequestURL()
getRequestURL in interface HttpServletRequestpublic java.lang.String getContextPath()
HttpServletRequestgetContextPath() is /myapp for the uri
/myapp/servlet/Hello,
getContextPath in interface HttpServletRequestpublic java.lang.String getServletPath()
HttpServletRequestSCRIPT_NAME
getServletPath() is /servlet/Hello for the uri
/myapp/servlet/Hello/foo.
getServletPath() is /dir/hello.jsp
for the uri /myapp/dir/hello.jsp/foo,getServletPath in interface HttpServletRequestpublic java.lang.String getPathInfo()
HttpServletRequestPATH_INFO
getPathInfo() is /foo for
the uri /myapp/servlet/Hello/foo.
getPathInfo() is /hello.jsp for for the uri
/myapp/dir/hello.jsp/foo.
getPathInfo in interface HttpServletRequestpublic java.lang.String getPathTranslated()
getPathTranslated in interface HttpServletRequestpublic java.lang.String getQueryString()
HttpServletRequestServletRequest.getParameter() to decode the form values.
Corresponds to CGI's PATH_TRANSLATEDgetQueryString in interface HttpServletRequestpublic java.lang.String getHeader(java.lang.String name)
HttpServletRequestHTTP_*
String userAgent = request.getHeader("User-Agent");
getHeader in interface HttpServletRequestname - the header namepublic java.util.Enumeration<java.lang.String> getHeaders(java.lang.String name)
HttpServletRequestgetHeaders in interface HttpServletRequestname - the header namepublic java.util.Enumeration<java.lang.String> getHeaderNames()
HttpServletRequestgetHeaderNames in interface HttpServletRequestpublic int getIntHeader(java.lang.String name)
HttpServletRequestgetIntHeader in interface HttpServletRequestname - the header namepublic long getDateHeader(java.lang.String name)
HttpServletRequest
long mod = request.getDateHeader("If-Modified-Since");
getDateHeader in interface HttpServletRequestname - the header namepublic Cookie[] getCookies()
HttpServletRequestgetCookies in interface HttpServletRequestpublic java.lang.String getRequestedSessionId()
HttpServletRequestgetRequestedSessionId in interface HttpServletRequestpublic boolean isRequestedSessionIdValid()
HttpServletRequestisRequestedSessionIdValid in interface HttpServletRequestpublic boolean isRequestedSessionIdFromCookie()
HttpServletRequestisRequestedSessionIdFromCookie in interface HttpServletRequestpublic boolean isRequestedSessionIdFromURL()
HttpServletRequestisRequestedSessionIdFromURL in interface HttpServletRequestpublic void setSessionId(java.lang.String sessionId)
setSessionId in interface CauchoRequestpublic java.lang.String getSessionId()
getSessionId in interface CauchoRequestpublic boolean isSessionIdFromCookie()
isSessionIdFromCookie in interface CauchoRequestpublic java.lang.String getAuthType()
HttpServletRequestgetAuthType in interface HttpServletRequestpublic java.lang.String getRemoteUser()
HttpServletRequestgetRemoteUser in interface HttpServletRequestpublic boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl in interface HttpServletRequestpublic Part getPart(java.lang.String name) throws java.io.IOException, ServletException
getPart in interface HttpServletRequestjava.io.IOExceptionServletExceptionpublic java.util.Collection<Part> getParts() throws java.io.IOException, ServletException
getParts in interface HttpServletRequestjava.io.IOExceptionServletExceptionpublic boolean isMultipartEnabled()
isMultipartEnabled in interface CauchoRequestpublic void logout()
throws ServletException
logout in interface HttpServletRequestServletExceptionpublic java.lang.String getPageURI()
getPageURI in interface CauchoRequestpublic java.lang.String getPageContextPath()
getPageContextPath in interface CauchoRequestpublic java.lang.String getPageServletPath()
getPageServletPath in interface CauchoRequestpublic java.lang.String getPagePathInfo()
getPagePathInfo in interface CauchoRequestpublic java.lang.String getPageQueryString()
getPageQueryString in interface CauchoRequestpublic WebApp getWebApp()
getWebApp in interface CauchoRequestpublic ReadStream getStream() throws java.io.IOException
getStream in interface CauchoRequestjava.io.IOExceptionpublic int getRequestDepth(int depth)
getRequestDepth in interface CauchoRequestpublic void setHeader(java.lang.String key,
java.lang.String value)
setHeader in interface CauchoRequestpublic boolean isSyntheticCacheHeader()
isSyntheticCacheHeader in interface CauchoRequestpublic void setSyntheticCacheHeader(boolean isSynthetic)
setSyntheticCacheHeader in interface CauchoRequestpublic boolean getVaryCookies()
getVaryCookies in interface CauchoRequestpublic void setVaryCookie(java.lang.String cookie)
setVaryCookie in interface CauchoRequestpublic boolean getHasCookie()
getHasCookie in interface CauchoRequestpublic boolean isTop()
isTop in interface CauchoRequestpublic boolean hasRequest()
hasRequest in interface CauchoRequestpublic HttpSession getMemorySession()
getMemorySession in interface CauchoRequestpublic Cookie getCookie(java.lang.String name)
getCookie in interface CauchoRequestpublic void setHasCookie()
setHasCookie in interface CauchoRequestpublic void killKeepalive(java.lang.String reason)
killKeepalive in interface CauchoRequestpublic boolean isSuspend()
isSuspend in interface CauchoRequestpublic boolean isComet()
isComet in interface CauchoRequestpublic boolean isDuplex()
isDuplex in interface CauchoRequestpublic boolean isConnectionClosed()
isConnectionClosed in interface CauchoRequestpublic boolean isLoginRequested()
isLoginRequested in interface CauchoRequestpublic void requestLogin()
requestLogin in interface CauchoRequestpublic ServletResponse getServletResponse()
getServletResponse in interface CauchoRequestpublic AbstractHttpRequest getAbstractHttpRequest()
getAbstractHttpRequest in interface CauchoRequestpublic HttpSession getSession(boolean create)
HttpServletRequestgetSession in interface HttpServletRequestcreate - If true, then create a new session if none exists.public HttpSession getSession()
HttpServletRequestgetSession in interface HttpServletRequestpublic boolean isUserInRole(java.lang.String role)
HttpServletRequestisUserInRole in interface HttpServletRequestpublic java.security.Principal getUserPrincipal()
HttpServletRequestgetUserPrincipal in interface HttpServletRequestpublic boolean authenticate(HttpServletResponse response) throws java.io.IOException, ServletException
authenticate in interface HttpServletRequestjava.io.IOExceptionServletExceptionpublic void login(java.lang.String username,
java.lang.String password)
throws ServletException
login in interface HttpServletRequestServletExceptionpublic java.lang.String getRealPath(java.lang.String uri)
ServletRequestgetRealPath in interface ServletRequestpublic boolean login(boolean isFail)
login in interface CauchoRequestpublic SocketLink getSocketLink()
getSocketLink in interface CauchoRequestpublic java.lang.String toString()
toString in class java.lang.Object