public class RequestWrapper extends Object implements javax.servlet.http.HttpServletRequest
| Constructor and Description |
|---|
RequestWrapper(javax.servlet.ServletRequest request)
Creates a ServletRequest adaptor wrapping the given request object.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
authenticate(javax.servlet.http.HttpServletResponse response)
The default behavior of this method is to call authenticate on the
wrapped request object.
|
String |
changeSessionId()
The default behavior of this method is to return changeSessionId()
on the wrapped request object.
|
javax.servlet.AsyncContext |
getAsyncContext()
Gets the AsyncContext that was created or reinitialized by the
most recent invocation of
startAsync() or
startAsync(ServletRequest,ServletResponse) on the wrapped
request. |
Object |
getAttribute(String name)
The default behavior of this method is to call getAttribute(String name)
on the wrapped request object.
|
Enumeration<String> |
getAttributeNames()
The default behavior of this method is to return getAttributeNames()
on the wrapped request object.
|
String |
getAuthType()
The default behavior of this method is to return getAuthType()
on the wrapped request object.
|
String |
getCharacterEncoding()
The default behavior of this method is to return getCharacterEncoding()
on the wrapped request object.
|
int |
getContentLength()
The default behavior of this method is to return getContentLength()
on the wrapped request object.
|
long |
getContentLengthLong()
The default behavior of this method is to return getContentLengthLong()
on the wrapped request object.
|
String |
getContentType()
The default behavior of this method is to return getContentType()
on the wrapped request object.
|
String |
getContextPath()
The default behavior of this method is to return getContextPath()
on the wrapped request object.
|
javax.servlet.http.Cookie[] |
getCookies()
The default behavior of this method is to return getCookies()
on the wrapped request object.
|
long |
getDateHeader(String name)
The default behavior of this method is to return getDateHeader(String name)
on the wrapped request object.
|
javax.servlet.DispatcherType |
getDispatcherType()
Gets the dispatcher type of the wrapped request.
|
String |
getHeader(String name)
The default behavior of this method is to return getHeader(String name)
on the wrapped request object.
|
Enumeration<String> |
getHeaderNames()
The default behavior of this method is to return getHeaderNames()
on the wrapped request object.
|
Enumeration<String> |
getHeaders(String name)
The default behavior of this method is to return getHeaders(String name)
on the wrapped request object.
|
javax.servlet.ServletInputStream |
getInputStream()
The default behavior of this method is to return getInputStream()
on the wrapped request object.
|
int |
getIntHeader(String name)
The default behavior of this method is to return
getIntHeader(String name) on the wrapped request object.
|
String |
getLocalAddr()
The default behavior of this method is to return
getLocalAddr() on the wrapped request object.
|
Locale |
getLocale()
The default behavior of this method is to return getLocale()
on the wrapped request object.
|
Enumeration<Locale> |
getLocales()
The default behavior of this method is to return getLocales()
on the wrapped request object.
|
String |
getLocalName()
The default behavior of this method is to return
getLocalName() on the wrapped request object.
|
int |
getLocalPort()
The default behavior of this method is to return
getLocalPort() on the wrapped request object.
|
String |
getMethod()
The default behavior of this method is to return getMethod()
on the wrapped request object.
|
String |
getParameter(String name)
The default behavior of this method is to return
getParameter(String name) on the wrapped request object.
|
Map<String,String[]> |
getParameterMap()
The default behavior of this method is to return getParameterMap()
on the wrapped request object.
|
Enumeration<String> |
getParameterNames()
The default behavior of this method is to return getParameterNames()
on the wrapped request object.
|
String[] |
getParameterValues(String name)
The default behavior of this method is to return
getParameterValues(String name) on the wrapped request object.
|
javax.servlet.http.Part |
getPart(String name)
The default behavior of this method is to call getPart on the wrapped
request object.
|
Collection<javax.servlet.http.Part> |
getParts()
The default behavior of this method is to call getParts on the wrapped
request object.
|
String |
getPathInfo()
The default behavior of this method is to return getPathInfo()
on the wrapped request object.
|
String |
getPathTranslated()
The default behavior of this method is to return getPathTranslated()
on the wrapped request object.
|
String |
getProtocol()
The default behavior of this method is to return getProtocol()
on the wrapped request object.
|
String |
getQueryString()
The default behavior of this method is to return getQueryString()
on the wrapped request object.
|
BufferedReader |
getReader()
The default behavior of this method is to return getReader()
on the wrapped request object.
|
String |
getRealPath(String path)
Deprecated.
As of Version 2.1 of the Java Servlet API,
use
ServletContext.getRealPath(java.lang.String) instead |
String |
getRemoteAddr()
The default behavior of this method is to return getRemoteAddr()
on the wrapped request object.
|
String |
getRemoteHost()
The default behavior of this method is to return getRemoteHost()
on the wrapped request object.
|
int |
getRemotePort()
The default behavior of this method is to return
getRemotePort() on the wrapped request object.
|
String |
getRemoteUser()
The default behavior of this method is to return getRemoteUser()
on the wrapped request object.
|
javax.servlet.ServletRequest |
getRequest()
Return the wrapped request object.
|
javax.servlet.RequestDispatcher |
getRequestDispatcher(String path)
The default behavior of this method is to return
getRequestDispatcher(String path) on the wrapped request object.
|
String |
getRequestedSessionId()
The default behavior of this method is to return getRequestedSessionId()
on the wrapped request object.
|
String |
getRequestURI()
The default behavior of this method is to return getRequestURI()
on the wrapped request object.
|
StringBuffer |
getRequestURL()
The default behavior of this method is to return getRequestURL()
on the wrapped request object.
|
String |
getScheme()
The default behavior of this method is to return getScheme()
on the wrapped request object.
|
String |
getServerName()
The default behavior of this method is to return getServerName()
on the wrapped request object.
|
int |
getServerPort()
The default behavior of this method is to return getServerPort()
on the wrapped request object.
|
javax.servlet.ServletContext |
getServletContext()
Gets the servlet context to which the wrapped servlet request was last
dispatched.
|
String |
getServletPath()
The default behavior of this method is to return getServletPath()
on the wrapped request object.
|
javax.servlet.http.HttpSession |
getSession()
The default behavior of this method is to return getSession()
on the wrapped request object.
|
javax.servlet.http.HttpSession |
getSession(boolean create)
The default behavior of this method is to return getSession(boolean create)
on the wrapped request object.
|
Principal |
getUserPrincipal()
The default behavior of this method is to return getUserPrincipal()
on the wrapped request object.
|
boolean |
isAsyncStarted()
Checks if the wrapped request has been put into asynchronous mode.
|
boolean |
isAsyncSupported()
Checks if the wrapped request supports asynchronous operation.
|
boolean |
isRequestedSessionIdFromCookie()
The default behavior of this method is to return isRequestedSessionIdFromCookie()
on the wrapped request object.
|
boolean |
isRequestedSessionIdFromUrl()
The default behavior of this method is to return isRequestedSessionIdFromUrl()
on the wrapped request object.
|
boolean |
isRequestedSessionIdFromURL()
The default behavior of this method is to return isRequestedSessionIdFromURL()
on the wrapped request object.
|
boolean |
isRequestedSessionIdValid()
The default behavior of this method is to return isRequestedSessionIdValid()
on the wrapped request object.
|
boolean |
isSecure()
The default behavior of this method is to return isSecure()
on the wrapped request object.
|
boolean |
isUserInRole(String role)
The default behavior of this method is to return isUserInRole(String role)
on the wrapped request object.
|
boolean |
isWrapperFor(Class<?> wrappedType)
Checks (recursively) if this ServletRequestWrapper wraps a
ServletRequest of the given class type. |
boolean |
isWrapperFor(javax.servlet.ServletRequest wrapped)
Checks (recursively) if this ServletRequestWrapper wraps the given
ServletRequest instance. |
void |
login(String username,
String password)
The default behavior of this method is to call login on the wrapped
request object.
|
void |
logout()
The default behavior of this method is to call login on the wrapped
request object.
|
void |
removeAttribute(String name)
The default behavior of this method is to call
removeAttribute(String name) on the wrapped request object.
|
void |
setAttribute(String name,
Object o)
The default behavior of this method is to return
setAttribute(String name, Object o) on the wrapped request object.
|
void |
setCharacterEncoding(String enc)
The default behavior of this method is to set the character encoding
on the wrapped request object.
|
void |
setRequest(javax.servlet.ServletRequest request)
Sets the request object being wrapped.
|
javax.servlet.AsyncContext |
startAsync()
The default behavior of this method is to invoke
ServletRequest.startAsync() on the wrapped request object. |
javax.servlet.AsyncContext |
startAsync(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse)
The default behavior of this method is to invoke
ServletRequest.startAsync(ServletRequest, ServletResponse)
on the wrapped request object. |
<T extends javax.servlet.http.HttpUpgradeHandler> |
upgrade(Class<T> handlerClass)
Create an instance of
HttpUpgradeHandler for an given
class and uses it for the http protocol upgrade processing. |
public RequestWrapper(javax.servlet.ServletRequest request)
IllegalArgumentException - if the request is nullpublic javax.servlet.ServletRequest getRequest()
public void setRequest(javax.servlet.ServletRequest request)
IllegalArgumentException - if the request is null.public Object getAttribute(String name)
getAttribute in interface javax.servlet.ServletRequestpublic Enumeration<String> getAttributeNames()
getAttributeNames in interface javax.servlet.ServletRequestpublic String getCharacterEncoding()
getCharacterEncoding in interface javax.servlet.ServletRequestpublic void setCharacterEncoding(String enc) throws UnsupportedEncodingException
setCharacterEncoding in interface javax.servlet.ServletRequestUnsupportedEncodingExceptionpublic int getContentLength()
getContentLength in interface javax.servlet.ServletRequestpublic long getContentLengthLong()
getContentLengthLong in interface javax.servlet.ServletRequestpublic String getContentType()
getContentType in interface javax.servlet.ServletRequestpublic javax.servlet.ServletInputStream getInputStream() throws IOException
getInputStream in interface javax.servlet.ServletRequestIOExceptionpublic String getParameter(String name)
getParameter in interface javax.servlet.ServletRequestpublic Map<String,String[]> getParameterMap()
getParameterMap in interface javax.servlet.ServletRequestpublic Enumeration<String> getParameterNames()
getParameterNames in interface javax.servlet.ServletRequestpublic String[] getParameterValues(String name)
getParameterValues in interface javax.servlet.ServletRequestpublic String getProtocol()
getProtocol in interface javax.servlet.ServletRequestpublic String getScheme()
getScheme in interface javax.servlet.ServletRequestpublic String getServerName()
getServerName in interface javax.servlet.ServletRequestpublic int getServerPort()
getServerPort in interface javax.servlet.ServletRequestpublic BufferedReader getReader() throws IOException
getReader in interface javax.servlet.ServletRequestIOExceptionpublic String getRemoteAddr()
getRemoteAddr in interface javax.servlet.ServletRequestpublic String getRemoteHost()
getRemoteHost in interface javax.servlet.ServletRequestpublic void setAttribute(String name, Object o)
setAttribute in interface javax.servlet.ServletRequestpublic void removeAttribute(String name)
removeAttribute in interface javax.servlet.ServletRequestpublic Locale getLocale()
getLocale in interface javax.servlet.ServletRequestpublic Enumeration<Locale> getLocales()
getLocales in interface javax.servlet.ServletRequestpublic boolean isSecure()
isSecure in interface javax.servlet.ServletRequestpublic javax.servlet.RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher in interface javax.servlet.ServletRequestpublic String getRealPath(String path)
ServletContext.getRealPath(java.lang.String) insteadgetRealPath in interface javax.servlet.ServletRequestpublic int getRemotePort()
getRemotePort in interface javax.servlet.ServletRequestpublic String getLocalName()
getLocalName in interface javax.servlet.ServletRequestpublic String getLocalAddr()
getLocalAddr in interface javax.servlet.ServletRequestpublic int getLocalPort()
getLocalPort in interface javax.servlet.ServletRequestpublic javax.servlet.ServletContext getServletContext()
getServletContext in interface javax.servlet.ServletRequestpublic javax.servlet.AsyncContext startAsync() throws IllegalStateException
ServletRequest.startAsync() on the wrapped request object.startAsync in interface javax.servlet.ServletRequestIllegalStateException - if the request is within the scope of
a filter or servlet that does not support asynchronous operations
(that is, isAsyncSupported() returns false),
or if this method is called again without any asynchronous dispatch
(resulting from one of the AsyncContext.dispatch() methods),
is called outside the scope of any such dispatch, or is called again
within the scope of the same dispatch, or if the response has
already been closedServletRequest.startAsync()public javax.servlet.AsyncContext startAsync(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) throws IllegalStateException
ServletRequest.startAsync(ServletRequest, ServletResponse)
on the wrapped request object.startAsync in interface javax.servlet.ServletRequestservletRequest - the ServletRequest used to initialize the
AsyncContextservletResponse - the ServletResponse used to initialize the
AsyncContextIllegalStateException - if the request is within the scope of
a filter or servlet that does not support asynchronous operations
(that is, isAsyncSupported() returns false),
or if this method is called again without any asynchronous dispatch
(resulting from one of the AsyncContext.dispatch() methods),
is called outside the scope of any such dispatch, or is called again
within the scope of the same dispatch, or if the response has
already been closedServletRequest.startAsync(ServletRequest, ServletResponse)public boolean isAsyncStarted()
isAsyncStarted in interface javax.servlet.ServletRequestServletRequest.isAsyncStarted()public boolean isAsyncSupported()
isAsyncSupported in interface javax.servlet.ServletRequestServletRequest.isAsyncSupported()public javax.servlet.AsyncContext getAsyncContext()
startAsync() or
startAsync(ServletRequest,ServletResponse) on the wrapped
request.getAsyncContext in interface javax.servlet.ServletRequeststartAsync() or
startAsync(ServletRequest,ServletResponse) on
the wrapped requestIllegalStateException - if this request has not been put
into asynchronous mode, i.e., if neither startAsync() nor
startAsync(ServletRequest,ServletResponse) has been calledServletRequest.getAsyncContext()public boolean isWrapperFor(javax.servlet.ServletRequest wrapped)
ServletRequest instance.wrapped - the ServletRequest instance to search forpublic boolean isWrapperFor(Class<?> wrappedType)
ServletRequest of the given class type.wrappedType - the ServletRequest class type to
search forIllegalArgumentException - if the given class does not
implement ServletRequestpublic javax.servlet.DispatcherType getDispatcherType()
getDispatcherType in interface javax.servlet.ServletRequestServletRequest.getDispatcherType()public String getAuthType()
getAuthType in interface javax.servlet.http.HttpServletRequestpublic javax.servlet.http.Cookie[] getCookies()
getCookies in interface javax.servlet.http.HttpServletRequestpublic long getDateHeader(String name)
getDateHeader in interface javax.servlet.http.HttpServletRequestpublic String getHeader(String name)
getHeader in interface javax.servlet.http.HttpServletRequestpublic Enumeration<String> getHeaders(String name)
getHeaders in interface javax.servlet.http.HttpServletRequestpublic Enumeration<String> getHeaderNames()
getHeaderNames in interface javax.servlet.http.HttpServletRequestpublic int getIntHeader(String name)
getIntHeader in interface javax.servlet.http.HttpServletRequestpublic String getMethod()
getMethod in interface javax.servlet.http.HttpServletRequestpublic String getPathInfo()
getPathInfo in interface javax.servlet.http.HttpServletRequestpublic String getPathTranslated()
getPathTranslated in interface javax.servlet.http.HttpServletRequestpublic String getContextPath()
getContextPath in interface javax.servlet.http.HttpServletRequestpublic String getQueryString()
getQueryString in interface javax.servlet.http.HttpServletRequestpublic String getRemoteUser()
getRemoteUser in interface javax.servlet.http.HttpServletRequestpublic boolean isUserInRole(String role)
isUserInRole in interface javax.servlet.http.HttpServletRequestpublic Principal getUserPrincipal()
getUserPrincipal in interface javax.servlet.http.HttpServletRequestpublic String getRequestedSessionId()
getRequestedSessionId in interface javax.servlet.http.HttpServletRequestpublic String getRequestURI()
getRequestURI in interface javax.servlet.http.HttpServletRequestpublic StringBuffer getRequestURL()
getRequestURL in interface javax.servlet.http.HttpServletRequestpublic String getServletPath()
getServletPath in interface javax.servlet.http.HttpServletRequestpublic javax.servlet.http.HttpSession getSession(boolean create)
getSession in interface javax.servlet.http.HttpServletRequestpublic javax.servlet.http.HttpSession getSession()
getSession in interface javax.servlet.http.HttpServletRequestpublic String changeSessionId()
changeSessionId in interface javax.servlet.http.HttpServletRequestpublic boolean isRequestedSessionIdValid()
isRequestedSessionIdValid in interface javax.servlet.http.HttpServletRequestpublic boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie in interface javax.servlet.http.HttpServletRequestpublic boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL in interface javax.servlet.http.HttpServletRequestpublic boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl in interface javax.servlet.http.HttpServletRequestpublic boolean authenticate(javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
authenticate in interface javax.servlet.http.HttpServletRequestIOExceptionjavax.servlet.ServletExceptionpublic void login(String username, String password) throws javax.servlet.ServletException
login in interface javax.servlet.http.HttpServletRequestjavax.servlet.ServletExceptionpublic void logout() throws javax.servlet.ServletException
logout in interface javax.servlet.http.HttpServletRequestjavax.servlet.ServletExceptionpublic Collection<javax.servlet.http.Part> getParts() throws IOException, javax.servlet.ServletException
Any changes to the returned Collection must not
affect this HttpServletRequestWrapper.
getParts in interface javax.servlet.http.HttpServletRequestIOExceptionjavax.servlet.ServletExceptionpublic javax.servlet.http.Part getPart(String name) throws IOException, javax.servlet.ServletException
getPart in interface javax.servlet.http.HttpServletRequestIOExceptionjavax.servlet.ServletExceptionpublic <T extends javax.servlet.http.HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, javax.servlet.ServletException
HttpUpgradeHandler for an given
class and uses it for the http protocol upgrade processing.upgrade in interface javax.servlet.http.HttpServletRequestIOExceptionjavax.servlet.ServletException