public final class HttpServletRequestImpl extends AbstractCauchoRequest implements CauchoRequest, WebSocketServletRequest
AbstractCauchoRequest.PartImpl
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
Constructor and Description |
---|
HttpServletRequestImpl(AbstractHttpRequest request)
Create a new Request.
|
Modifier and Type | Method and Description |
---|---|
void |
addCloseOnExit(Path path)
Adds a file to be removed at the end.
|
void |
cleanup() |
protected java.lang.String |
findSessionIdFromCookie()
Returns the session id in the HTTP request cookies.
|
void |
finishInvocation() |
protected void |
finishRequest() |
AbstractHttpRequest |
getAbstractHttpRequest() |
AsyncContextImpl |
getAsyncContext()
Returns the async context for the request
|
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value of the named request attribute.
|
java.util.Enumeration<java.lang.String> |
getAttributeNames()
Returns an enumeration of the request attribute names.
|
java.lang.String |
getAuthType()
Gets the authorization type
|
java.lang.String |
getCharacterEncoding()
Returns the character encoding of the POSTed data.
|
SocketLink |
getConnection() |
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 context part of the uri.
|
Cookie |
getCookie(java.lang.String name)
Returns the named cookie from the browser
|
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()
True if this page uses cookies.
|
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.
|
Invocation |
getInvocation() |
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.
|
protected Login |
getLogin()
Returns the login for the request.
|
java.lang.String |
getMethod()
Returns the HTTP method, e.g.
|
java.lang.String |
getPageContextPath()
Returns the context part of the uri.
|
java.lang.String |
getPagePathInfo()
Returns the portion of the uri after the servlet path for the current
page.
|
java.lang.String |
getPageQueryString()
Returns the current page's query string.
|
java.lang.String |
getPageServletPath()
Returns the portion of the uri mapped to the servlet for the current
page.
|
java.lang.String |
getPageURI()
Returns the URI for the page.
|
java.lang.String |
getPathInfo()
Returns the portion of the uri after the servlet path for the original
request.
|
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 current page's query string.
|
java.io.BufferedReader |
getReader()
Returns a reader to read POSTed data.
|
java.lang.String |
getRealPath(java.lang.String path)
Deprecated.
As of JSDK 2.1
|
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()
Gets the remote user from the authorization type
|
java.lang.String |
getRemoteUser(boolean create)
Internal logging return to get the remote user.
|
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 in the HTTP request.
|
java.lang.String |
getRequestedSessionIdNoVary()
Returns the session id in the HTTP request.
|
java.lang.String |
getRequestURI()
Returns the URI for the request
|
java.lang.StringBuffer |
getRequestURL()
Returns the URL for the request
|
HttpServletResponseImpl |
getResponse() |
protected java.lang.String |
getRunAs() |
java.lang.String |
getScheme()
Returns the request scheme, e.g.
|
ServletService |
getServer() |
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 |
getServletName()
Returns the servlet name.
|
java.lang.String |
getServletPath()
Returns the portion of the uri mapped to the servlet for the original
request.
|
ServletResponse |
getServletResponse()
Returns the servlet response for the request
|
java.lang.String |
getSessionId() |
long |
getStartTime() |
ReadStream |
getStream() |
ReadStream |
getStream(boolean isFlush) |
boolean |
getVaryCookies()
Returns true if the page depends on cookies.
|
WebApp |
getWebApp()
Returns the invocation's webApp.
|
boolean |
hasRequest() |
boolean |
isAsyncStarted()
Returns true if the request is in async.
|
boolean |
isAsyncSupported()
Returns true if the request supports async
|
boolean |
isClosed() |
boolean |
isComet() |
boolean |
isConnectionClosed() |
boolean |
isDuplex() |
boolean |
isLoginRequested()
Returns true if any authentication is requested
|
boolean |
isRequestedSessionIdFromCookie()
Returns true if the current sessionId came from a cookie.
|
boolean |
isRequestedSessionIdFromUrl()
Deprecated.
|
boolean |
isRequestedSessionIdFromURL()
Returns true if the current sessionId came from the url.
|
boolean |
isSecure()
Returns true if the connection is secure, e.g.
|
boolean |
isSessionIdFromCookie() |
boolean |
isSuspend() |
boolean |
isSyntheticCacheHeader() |
boolean |
isTop() |
void |
killKeepalive(java.lang.String reason) |
void |
logout()
Logs out the principal.
|
void |
logoutUserPrincipal()
Clear the principal from the request object.
|
void |
removeAttribute(java.lang.String name)
Removes the value of the named request attribute.
|
void |
requestLogin() |
java.lang.String |
runAs(java.lang.String role)
Sets the overriding role.
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets the value of the named request attribute.
|
void |
setCharacterEncoding(java.lang.String encoding)
Overrides the character encoding specified in the request.
|
void |
setHasCookie()
Set when the page actually has a cookie.
|
void |
setHeader(java.lang.String key,
java.lang.String value) |
void |
setInvocation(Invocation invocation) |
void |
setSecure(java.lang.Boolean isSecure) |
void |
setSessionId(java.lang.String sessionId) |
void |
setSyntheticCacheHeader(boolean isSynthetic) |
void |
setVaryCookie(java.lang.String cookie)
Called if the page depends on a cookie.
|
AsyncContext |
startAsync()
Starts an async mode
|
AsyncContext |
startAsync(ServletRequest request,
ServletResponse response)
Starts an async mode
|
WebSocketContext |
startWebSocket(WebSocketListener listener)
Upgrade the current HTTP connection to a WebSocket connection
|
java.lang.String |
toString() |
authenticate, getLoadedSession, getMemorySession, getParameter, getParameterImpl, getParameterMap, getParameterMapImpl, getParameterNames, getParameterNamesImpl, getParameterValues, getParameterValuesImpl, getPart, getParts, getRequest, getSession, getSession, getSessionCookie, getSessionGroup, getSessionManager, getSocketLink, getUserPrincipal, isMultipartEnabled, isRequestedSessionIdValid, isUserInRole, login, login, mergeParameters, parseGetQueryImpl, parsePostQueryImpl, parseQueryImpl, startRequest
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getMemorySession, getSocketLink, isMultipartEnabled, login
authenticate, getPart, getParts, getSession, getSession, getUserPrincipal, isRequestedSessionIdValid, isUserInRole, login
getParameter, getParameterMap, getParameterNames, getParameterValues
public HttpServletRequestImpl(AbstractHttpRequest request)
request
- public HttpServletResponseImpl getResponse()
getResponse
in class AbstractCauchoRequest
public java.lang.String getProtocol()
getProtocol
in interface ServletRequest
public java.lang.String getScheme()
getScheme
in interface ServletRequest
public java.lang.String getServerName()
getServerName
in interface ServletRequest
public int getServerPort()
isSecure()
is provided for
that purpose.getServerPort
in interface ServletRequest
public java.lang.String getRemoteAddr()
getRemoteAddr
in interface ServletRequest
public java.lang.String getRemoteHost()
getRemoteHost
in interface ServletRequest
public int getRemotePort()
getRemotePort
in interface ServletRequest
public java.lang.String getLocalAddr()
getLocalAddr
in interface ServletRequest
public java.lang.String getLocalName()
getLocalName
in interface ServletRequest
public int getLocalPort()
isSecure()
is provided for that purpose.getLocalPort
in interface ServletRequest
public void setCharacterEncoding(java.lang.String encoding) throws java.io.UnsupportedEncodingException
setCharacterEncoding
must be called before calling
getReader
or reading any parameters.setCharacterEncoding
in interface ServletRequest
java.io.UnsupportedEncodingException
public ServletInputStream getInputStream() throws java.io.IOException
getInputStream
in interface ServletRequest
java.io.IOException
public java.io.BufferedReader getReader() throws java.io.IOException, java.lang.IllegalStateException
getCharacterEncoding()
getReader
in interface ServletRequest
java.io.IOException
java.lang.IllegalStateException
public java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface ServletRequest
public int getContentLength()
The upshot is, rely on the input stream to end when the data completes.
getContentLength
in interface ServletRequest
public java.lang.String getContentType()
getContentType
in interface ServletRequest
public java.util.Locale getLocale()
getLocale
in interface ServletRequest
public java.util.Enumeration<java.util.Locale> getLocales()
getLocales
in interface ServletRequest
public boolean isSecure()
isSecure
in interface ServletRequest
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface ServletRequest
name
- the attribute name.public java.util.Enumeration<java.lang.String> getAttributeNames()
getAttributeNames
in interface ServletRequest
public void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface ServletRequest
name
- the attribute name.value
- the new attribute value.public void removeAttribute(java.lang.String name)
removeAttribute
in interface ServletRequest
name
- the attribute name.public RequestDispatcher getRequestDispatcher(java.lang.String path)
uri
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 ServletRequest
getRequestDispatcher
in class AbstractCauchoRequest
path
- path relative to getRequestURI()
(including query string) for the included file.public ServletContext getServletContext()
getServletContext
in interface ServletRequest
public ServletResponse getServletResponse()
getServletResponse
in interface CauchoRequest
public java.lang.String getMethod()
REQUEST_METHOD
getMethod
in interface HttpServletRequest
public java.lang.String getRequestURI()
getRequestURI
in interface HttpServletRequest
public java.lang.String getPageURI()
getPageURI
in interface CauchoRequest
public java.lang.String getContextPath()
getContextPath
in interface HttpServletRequest
public java.lang.String getPageContextPath()
getPageContextPath
in interface CauchoRequest
public java.lang.String getServletPath()
getServletPath
in interface HttpServletRequest
public java.lang.String getPageServletPath()
getPageServletPath
in interface CauchoRequest
public java.lang.String getPathInfo()
getPathInfo
in interface HttpServletRequest
public java.lang.String getPagePathInfo()
getPagePathInfo
in interface CauchoRequest
public java.lang.StringBuffer getRequestURL()
getRequestURL
in interface HttpServletRequest
getRequestURL
in class AbstractCauchoRequest
public java.lang.String getRealPath(java.lang.String path)
ServletRequest
getRealPath
in interface ServletRequest
getRealPath
in class AbstractCauchoRequest
public java.lang.String getPathTranslated()
getPathTranslated
in interface HttpServletRequest
getPathTranslated
in class AbstractCauchoRequest
public java.lang.String getQueryString()
getQueryString
in interface HttpServletRequest
public java.lang.String getPageQueryString()
getPageQueryString
in interface CauchoRequest
public java.lang.String getHeader(java.lang.String name)
HTTP_*
String userAgent = request.getHeader("User-Agent");
getHeader
in interface HttpServletRequest
name
- the header namepublic java.util.Enumeration<java.lang.String> getHeaders(java.lang.String name)
getHeaders
in interface HttpServletRequest
name
- the header namepublic java.util.Enumeration<java.lang.String> getHeaderNames()
getHeaderNames
in interface HttpServletRequest
public int getIntHeader(java.lang.String name)
getIntHeader
in interface HttpServletRequest
name
- the header namepublic long getDateHeader(java.lang.String name)
long mod = request.getDateHeader("If-Modified-Since");
getDateHeader
in interface HttpServletRequest
name
- the header namepublic Cookie[] getCookies()
getCookies
in interface HttpServletRequest
public Cookie getCookie(java.lang.String name)
getCookie
in interface CauchoRequest
public java.lang.String getRequestedSessionId()
getRequestedSessionId
in interface HttpServletRequest
protected java.lang.String findSessionIdFromCookie()
public boolean isSessionIdFromCookie()
isSessionIdFromCookie
in interface CauchoRequest
isSessionIdFromCookie
in class AbstractCauchoRequest
public java.lang.String getSessionId()
getSessionId
in interface CauchoRequest
getSessionId
in class AbstractCauchoRequest
public void setSessionId(java.lang.String sessionId)
setSessionId
in interface CauchoRequest
setSessionId
in class AbstractCauchoRequest
public boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie
in interface HttpServletRequest
public boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL
in interface HttpServletRequest
public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl
in interface HttpServletRequest
public java.lang.String getRequestedSessionIdNoVary()
protected java.lang.String getRunAs()
getRunAs
in class AbstractCauchoRequest
public java.lang.String getAuthType()
getAuthType
in interface HttpServletRequest
protected Login getLogin()
public boolean isLoginRequested()
isLoginRequested
in interface CauchoRequest
isLoginRequested
in class AbstractCauchoRequest
public void requestLogin()
requestLogin
in interface CauchoRequest
requestLogin
in class AbstractCauchoRequest
public java.lang.String getRemoteUser()
getRemoteUser
in interface HttpServletRequest
public java.lang.String getRemoteUser(boolean create)
public void logout()
logout
in interface HttpServletRequest
public void logoutUserPrincipal()
public java.lang.String runAs(java.lang.String role)
public void setSecure(java.lang.Boolean isSecure)
public ReadStream getStream() throws java.io.IOException
getStream
in interface CauchoRequest
java.io.IOException
public ReadStream getStream(boolean isFlush) throws java.io.IOException
getStream
in class AbstractCauchoRequest
java.io.IOException
public int getRequestDepth(int depth)
getRequestDepth
in interface CauchoRequest
public void setHeader(java.lang.String key, java.lang.String value)
setHeader
in interface CauchoRequest
public void setSyntheticCacheHeader(boolean isSynthetic)
setSyntheticCacheHeader
in interface CauchoRequest
public boolean isSyntheticCacheHeader()
isSyntheticCacheHeader
in interface CauchoRequest
public void setVaryCookie(java.lang.String cookie)
setVaryCookie
in interface CauchoRequest
cookie
- the cookie the page depends on.public boolean getVaryCookies()
getVaryCookies
in interface CauchoRequest
public void setHasCookie()
setHasCookie
in interface CauchoRequest
public boolean getHasCookie()
getHasCookie
in interface CauchoRequest
public boolean isTop()
isTop
in interface CauchoRequest
isTop
in class AbstractCauchoRequest
public boolean isComet()
isComet
in interface CauchoRequest
public void addCloseOnExit(Path path)
addCloseOnExit
in class AbstractCauchoRequest
public boolean isDuplex()
isDuplex
in interface CauchoRequest
public void killKeepalive(java.lang.String reason)
killKeepalive
in interface CauchoRequest
public boolean isConnectionClosed()
isConnectionClosed
in interface CauchoRequest
public SocketLink getConnection()
public AbstractHttpRequest getAbstractHttpRequest()
getAbstractHttpRequest
in interface CauchoRequest
getAbstractHttpRequest
in class AbstractCauchoRequest
public boolean isSuspend()
isSuspend
in interface CauchoRequest
public boolean hasRequest()
hasRequest
in interface CauchoRequest
public void setInvocation(Invocation invocation)
public Invocation getInvocation()
getInvocation
in class AbstractCauchoRequest
public long getStartTime()
public void finishInvocation()
public boolean isAsyncStarted()
isAsyncStarted
in interface ServletRequest
public boolean isAsyncSupported()
isAsyncSupported
in interface ServletRequest
public AsyncContext startAsync()
startAsync
in interface ServletRequest
public AsyncContext startAsync(ServletRequest request, ServletResponse response)
startAsync
in interface ServletRequest
public AsyncContextImpl getAsyncContext()
getAsyncContext
in interface ServletRequest
public WebSocketContext startWebSocket(WebSocketListener listener) throws java.io.IOException
WebSocketServletRequest
startWebSocket
in interface WebSocketServletRequest
java.io.IOException
public DispatcherType getDispatcherType()
ServletRequest
getDispatcherType
in interface ServletRequest
protected void finishRequest() throws java.io.IOException
finishRequest
in class AbstractCauchoRequest
java.io.IOException
public void cleanup()
public java.lang.String getServletName()
public final ServletService getServer()
getServer
in class AbstractCauchoRequest
public final WebApp getWebApp()
getWebApp
in interface CauchoRequest
public boolean isClosed()
public java.lang.String toString()
toString
in class AbstractCauchoRequest