public class ServletRequestWrapper extends java.lang.Object implements ServletRequest
ServletRequest interface through to the underlying request
object| Constructor and Description |
|---|
ServletRequestWrapper(ServletRequest wrappedRequest)
Create a new wrapper which will wrap the given request
the default behaviour is to pass all method calls in
the ServletRequest interface to the
|
| Modifier and Type | Method and Description |
|---|---|
AsyncContext |
getAsyncContext()
Calls the underlying request object's method
|
java.lang.Object |
getAttribute(java.lang.String name)
Calls the wrapped request object's method
|
java.util.Enumeration |
getAttributeNames()
Calls the wrapped request object's method
|
java.lang.String |
getCharacterEncoding()
Calls the wrapped request object's method
|
int |
getContentLength()
Calls the wrapped request object's method
|
java.lang.String |
getContentType()
Calls the wrapped request object's method
|
DispatcherType |
getDispatcherType()
Calls the underlying request object's method
|
ServletInputStream |
getInputStream()
Calls the underlying request object's method
|
java.lang.String |
getLocalAddr()
Calls the underlying request object's method
|
java.util.Locale |
getLocale()
Calls the underlying request object's method
|
java.util.Enumeration |
getLocales()
Calls the underlying request object's method
|
java.lang.String |
getLocalName()
Calls the underlying request object's method
|
int |
getLocalPort()
Calls the underlying request object's method
|
java.lang.String |
getParameter(java.lang.String name)
Calls the underlying request object's method
|
java.util.Map |
getParameterMap()
Calls the underlying request object's method
|
java.util.Enumeration |
getParameterNames()
Calls the underlying request object's method
|
java.lang.String[] |
getParameterValues(java.lang.String name)
Calls the underlying request object's method
|
java.lang.String |
getProtocol()
Calls the underlying request object's method
|
java.io.BufferedReader |
getReader()
Calls the underlying request object's method
|
java.lang.String |
getRealPath(java.lang.String path)
Deprecated.
Should use getRealPath from the current ServletContext.
|
java.lang.String |
getRemoteAddr()
Calls the underlying request object's method
|
java.lang.String |
getRemoteHost()
Calls the underlying request object's method
|
int |
getRemotePort()
Calls the underlying request object's method
|
ServletRequest |
getRequest()
Get the request wrapped by this object
|
RequestDispatcher |
getRequestDispatcher(java.lang.String path)
Calls the underlying request object's method
|
java.lang.String |
getScheme()
Calls the underlying request object's method
|
java.lang.String |
getServerName()
Calls the underlying request object's method
|
int |
getServerPort()
Calls the underlying request object's method
|
ServletContext |
getServletContext()
Calls the underlying request object's method
|
boolean |
isAsyncStarted()
Calls the underlying request object's method
|
boolean |
isAsyncSupported()
Calls the underlying request object's method
|
boolean |
isSecure()
Calls the underlying request object's method
|
boolean |
isWrapperFor(java.lang.Class wrappedType)
Indicates if this wrapper wraps a request of the specified class.
|
boolean |
isWrapperFor(ServletRequest wrapped)
Indicates if this wrapper wraps the specified request.
|
void |
removeAttribute(java.lang.String name)
Calls the underlying request object's method
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Calls the underlying request object's method
|
void |
setCharacterEncoding(java.lang.String enc)
Calls the wrapped request object's method
|
void |
setRequest(ServletRequest wrappedRequest)
Sets a new wrapper
|
AsyncContext |
startAsync()
Calls the underlying request object's method
|
AsyncContext |
startAsync(ServletRequest request,
ServletResponse response)
Calls the underlying request object's method
|
public ServletRequestWrapper(ServletRequest wrappedRequest)
wrappedRequest - the request that will be wrapped
by this objectjava.lang.IllegalArgumentException - if wrappedRequest is nullpublic ServletRequest getRequest()
public void setRequest(ServletRequest wrappedRequest)
wrappedRequest - the request that will be wrapped
by this objectjava.lang.IllegalArgumentException - if wrappedRequest is nullpublic java.lang.Object getAttribute(java.lang.String name)
getAttribute in interface ServletRequestname - the attribute namepublic java.util.Enumeration getAttributeNames()
getAttributeNames in interface ServletRequestpublic java.lang.String getCharacterEncoding()
getCharacterEncoding in interface ServletRequestpublic void setCharacterEncoding(java.lang.String enc)
throws java.io.UnsupportedEncodingException
setCharacterEncoding in interface ServletRequestenc - a String containing the name of the character encodingjava.io.UnsupportedEncodingException - if the provided name is not
a valid encoding schemepublic int getContentLength()
getContentLength in interface ServletRequestpublic java.lang.String getContentType()
getContentType in interface ServletRequestpublic ServletInputStream getInputStream() throws java.io.IOException
getInputStream in interface ServletRequestjava.io.IOExceptionjava.lang.IllegalStateExceptionServletRequest.getReader()public java.lang.String getParameter(java.lang.String name)
getParameter in interface ServletRequestname - the name of the parameter whose value we wantpublic java.util.Map getParameterMap()
getParameterMap in interface ServletRequestpublic java.util.Enumeration getParameterNames()
getParameterNames in interface ServletRequestpublic java.lang.String[] getParameterValues(java.lang.String name)
getParameterValues in interface ServletRequestname - the parameter namepublic java.lang.String getProtocol()
getProtocol in interface ServletRequestpublic java.lang.String getScheme()
getScheme in interface ServletRequestpublic java.lang.String getServerName()
getServerName in interface ServletRequestpublic int getServerPort()
getServerPort in interface ServletRequestpublic java.io.BufferedReader getReader()
throws java.io.IOException
getReader in interface ServletRequestjava.io.IOExceptionjava.io.UnsupportedEncodingExceptionjava.lang.IllegalStateExceptionServletRequest.getInputStream()public java.lang.String getRemoteAddr()
getRemoteAddr in interface ServletRequestpublic java.lang.String getRemoteHost()
getRemoteHost in interface ServletRequestpublic void setAttribute(java.lang.String name,
java.lang.Object value)
setAttribute in interface ServletRequestname - - which is used to refer to this objectServletRequest.getAttribute(java.lang.String),
RequestDispatcherpublic void removeAttribute(java.lang.String name)
removeAttribute in interface ServletRequestname - the name of the attribute to be removedpublic java.util.Locale getLocale()
getLocale in interface ServletRequestpublic java.util.Enumeration getLocales()
getLocales in interface ServletRequestpublic boolean isSecure()
isSecure in interface ServletRequestpublic RequestDispatcher getRequestDispatcher(java.lang.String path)
getRequestDispatcher in interface ServletRequestpath - if relative it will be resolvedpublic java.lang.String getRealPath(java.lang.String path)
getRealPath in interface ServletRequestpath - the path which requires translatingServletContext.getRealPath(java.lang.String)public int getRemotePort()
getRemotePort in interface ServletRequestpublic java.lang.String getLocalName()
throws java.io.IOException
getLocalName in interface ServletRequestjava.io.IOExceptionpublic java.lang.String getLocalAddr()
throws java.io.IOException
getLocalAddr in interface ServletRequestjava.io.IOExceptionpublic int getLocalPort()
throws java.io.IOException
getLocalPort in interface ServletRequestjava.io.IOExceptionpublic ServletContext getServletContext()
getServletContext in interface ServletRequestpublic AsyncContext startAsync() throws java.lang.IllegalStateException
startAsync in interface ServletRequestjava.lang.IllegalStateExceptionpublic AsyncContext startAsync(ServletRequest request, ServletResponse response) throws java.lang.IllegalStateException
startAsync in interface ServletRequestjava.lang.IllegalStateExceptionpublic boolean isAsyncStarted()
isAsyncStarted in interface ServletRequestpublic boolean isAsyncSupported()
isAsyncSupported in interface ServletRequestpublic AsyncContext getAsyncContext()
getAsyncContext in interface ServletRequestpublic boolean isWrapperFor(ServletRequest wrapped)
public boolean isWrapperFor(java.lang.Class wrappedType)
public DispatcherType getDispatcherType()
getDispatcherType in interface ServletRequest