public class ServletRequestWrapper extends java.lang.Object implements ServletRequest
ServletRequest
interface through to the underlying request
objectConstructor 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 ServletRequest
name
- the attribute namepublic java.util.Enumeration getAttributeNames()
getAttributeNames
in interface ServletRequest
public java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface ServletRequest
public void setCharacterEncoding(java.lang.String enc) throws java.io.UnsupportedEncodingException
setCharacterEncoding
in interface ServletRequest
enc
- 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 ServletRequest
public java.lang.String getContentType()
getContentType
in interface ServletRequest
public ServletInputStream getInputStream() throws java.io.IOException
getInputStream
in interface ServletRequest
java.io.IOException
java.lang.IllegalStateException
ServletRequest.getReader()
public java.lang.String getParameter(java.lang.String name)
getParameter
in interface ServletRequest
name
- the name of the parameter whose value we wantpublic java.util.Map getParameterMap()
getParameterMap
in interface ServletRequest
public java.util.Enumeration getParameterNames()
getParameterNames
in interface ServletRequest
public java.lang.String[] getParameterValues(java.lang.String name)
getParameterValues
in interface ServletRequest
name
- the parameter namepublic 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()
getServerPort
in interface ServletRequest
public java.io.BufferedReader getReader() throws java.io.IOException
getReader
in interface ServletRequest
java.io.IOException
java.io.UnsupportedEncodingException
java.lang.IllegalStateException
ServletRequest.getInputStream()
public java.lang.String getRemoteAddr()
getRemoteAddr
in interface ServletRequest
public java.lang.String getRemoteHost()
getRemoteHost
in interface ServletRequest
public void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface ServletRequest
name
- - which is used to refer to this objectServletRequest.getAttribute(java.lang.String)
,
RequestDispatcher
public void removeAttribute(java.lang.String name)
removeAttribute
in interface ServletRequest
name
- the name of the attribute to be removedpublic java.util.Locale getLocale()
getLocale
in interface ServletRequest
public java.util.Enumeration getLocales()
getLocales
in interface ServletRequest
public boolean isSecure()
isSecure
in interface ServletRequest
public RequestDispatcher getRequestDispatcher(java.lang.String path)
getRequestDispatcher
in interface ServletRequest
path
- if relative it will be resolvedpublic java.lang.String getRealPath(java.lang.String path)
getRealPath
in interface ServletRequest
path
- the path which requires translatingServletContext.getRealPath(java.lang.String)
public int getRemotePort()
getRemotePort
in interface ServletRequest
public java.lang.String getLocalName() throws java.io.IOException
getLocalName
in interface ServletRequest
java.io.IOException
public java.lang.String getLocalAddr() throws java.io.IOException
getLocalAddr
in interface ServletRequest
java.io.IOException
public int getLocalPort() throws java.io.IOException
getLocalPort
in interface ServletRequest
java.io.IOException
public ServletContext getServletContext()
getServletContext
in interface ServletRequest
public AsyncContext startAsync() throws java.lang.IllegalStateException
startAsync
in interface ServletRequest
java.lang.IllegalStateException
public AsyncContext startAsync(ServletRequest request, ServletResponse response) throws java.lang.IllegalStateException
startAsync
in interface ServletRequest
java.lang.IllegalStateException
public boolean isAsyncStarted()
isAsyncStarted
in interface ServletRequest
public boolean isAsyncSupported()
isAsyncSupported
in interface ServletRequest
public AsyncContext getAsyncContext()
getAsyncContext
in interface ServletRequest
public boolean isWrapperFor(ServletRequest wrapped)
public boolean isWrapperFor(java.lang.Class wrappedType)
public DispatcherType getDispatcherType()
getDispatcherType
in interface ServletRequest