public class ServletRequestWrapper extends Object implements ServletRequest
ServletRequest
Constructor and Description |
---|
ServletRequestWrapper(ServletRequest request)
Creates a ServletRequest adaptor wrapping the given request object.
|
Modifier and Type | Method and Description |
---|---|
AsyncContext |
getAsyncContext()
The default behavior of this method is to return getAsyncContext() on the
wrapped request object.
|
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 |
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.
|
String |
getContentType()
The default behavior of this method is to return getContentType() on the
wrapped request object.
|
DispatcherType |
getDispatcherType()
The default behavior of this method is to call getDispatcherType() on the
wrapped request object.
|
ServletInputStream |
getInputStream()
The default behavior of this method is to return getInputStream() 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 |
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.
|
String |
getProtocol()
The default behavior of this method is to return getProtocol() 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 3.0 of the Java Servlet API
|
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.
|
ServletRequest |
getRequest()
Get the wrapped request.
|
RequestDispatcher |
getRequestDispatcher(String path)
The default behavior of this method is to return
getRequestDispatcher(String path) 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.
|
ServletContext |
getServletContext()
The default behavior of this method is to return getServletContext() on
the wrapped request object.
|
boolean |
isAsyncStarted()
The default behavior of this method is to return isAsyncStarted() on the
wrapped request object.
|
boolean |
isAsyncSupported()
The default behavior of this method is to return isAsyncSupported() on
the wrapped request object.
|
boolean |
isSecure()
The default behavior of this method is to return isSecure() on the
wrapped request object.
|
boolean |
isWrapperFor(Class wrappedType)
TODO SERVLET3 - Add comments
|
boolean |
isWrapperFor(ServletRequest wrapped)
TODO SERVLET3 - Add comments
|
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(ServletRequest request)
Sets the request object being wrapped.
|
AsyncContext |
startAsync()
The default behavior of this method is to return startAsync() on the
wrapped request object.
|
AsyncContext |
startAsync(ServletRequest servletRequest,
ServletResponse servletResponse)
The default behavior of this method is to return startAsync(Runnable) on
the wrapped request object.
|
public ServletRequestWrapper(ServletRequest request)
request
- The request to wrapIllegalArgumentException
- if the request is nullpublic ServletRequest getRequest()
public void setRequest(ServletRequest request)
request
- The new wrapped request.IllegalArgumentException
- if the request is null.public Object getAttribute(String name)
getAttribute
in interface ServletRequest
name
- a String
specifying the name of the attributeObject
containing the value of the attribute, or
null
if the attribute does not existpublic Enumeration<String> getAttributeNames()
getAttributeNames
in interface ServletRequest
Enumeration
of strings containing the names of the
request's attributespublic String getCharacterEncoding()
getCharacterEncoding
in interface ServletRequest
String
containing the name of the character
encoding, or null
if the request does not specify a
character encodingpublic void setCharacterEncoding(String enc) throws UnsupportedEncodingException
setCharacterEncoding
in interface ServletRequest
enc
- a String
containing the name of the character
encoding.UnsupportedEncodingException
- if this is not a valid encodingpublic int getContentLength()
getContentLength
in interface ServletRequest
public String getContentType()
getContentType
in interface ServletRequest
String
containing the name of the MIME type of the
request, or null if the type is not knownpublic ServletInputStream getInputStream() throws IOException
getInputStream
in interface ServletRequest
ServletInputStream
object containing the body of the
requestIOException
- if an input or output exception occurredpublic String getParameter(String name)
getParameter
in interface ServletRequest
name
- a String
specifying the name of the parameterString
representing the single value of the
parameterServletRequest.getParameterValues(java.lang.String)
public Map<String,String[]> getParameterMap()
getParameterMap
in interface ServletRequest
public Enumeration<String> getParameterNames()
getParameterNames
in interface ServletRequest
Enumeration
of String
objects, each
String
containing the name of a request parameter;
or an empty Enumeration
if the request has no
parameterspublic String[] getParameterValues(String name)
getParameterValues
in interface ServletRequest
name
- a String
containing the name of the parameter
whose value is requestedString
objects containing the parameter's
valuesServletRequest.getParameter(java.lang.String)
public String getProtocol()
getProtocol
in interface ServletRequest
String
containing the protocol name and version
numberpublic String getScheme()
getScheme
in interface ServletRequest
String
containing the name of the scheme used to
make this requestpublic String getServerName()
getServerName
in interface ServletRequest
String
containing the name of the serverpublic int getServerPort()
getServerPort
in interface ServletRequest
public BufferedReader getReader() throws IOException
getReader
in interface ServletRequest
BufferedReader
containing the body of the requestUnsupportedEncodingException
- if the character set encoding used is not supported and
the text cannot be decodedIOException
- if an input or output exception occurredServletRequest.getInputStream()
public String getRemoteAddr()
getRemoteAddr
in interface ServletRequest
String
containing the IP address of the client
that sent the requestpublic String getRemoteHost()
getRemoteHost
in interface ServletRequest
String
containing the fully qualified name of the
clientpublic void setAttribute(String name, Object o)
setAttribute
in interface ServletRequest
name
- a String
specifying the name of the attributeo
- the Object
to be storedpublic void removeAttribute(String name)
removeAttribute
in interface ServletRequest
name
- a String
specifying the name of the attribute to
removepublic Locale getLocale()
getLocale
in interface ServletRequest
Locale
for the clientpublic Enumeration<Locale> getLocales()
getLocales
in interface ServletRequest
Enumeration
of preferred Locale
objects for the clientpublic boolean isSecure()
isSecure
in interface ServletRequest
public RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher
in interface ServletRequest
path
- a String
specifying the pathname to the resource.
If it is relative, it must be relative against the current
servlet.RequestDispatcher
object that acts as a wrapper for
the resource at the specified path, or null
if the
servlet container cannot return a RequestDispatcher
RequestDispatcher
,
ServletContext.getRequestDispatcher(java.lang.String)
public String getRealPath(String path)
getRealPath
in interface ServletRequest
path
- The virtual path to be converted to a real pathServletContext.getRealPath(String)
public int getRemotePort()
getRemotePort
in interface ServletRequest
public String getLocalName()
getLocalName
in interface ServletRequest
String
containing the host name of the IP on which
the request was received.public String getLocalAddr()
getLocalAddr
in interface ServletRequest
String
containing the IP address on which the
request was received.public int getLocalPort()
getLocalPort
in interface ServletRequest
public ServletContext getServletContext()
getServletContext
in interface ServletRequest
public AsyncContext startAsync()
startAsync
in interface ServletRequest
IllegalStateException
- If asynchronous processing is not supported
for this request or if the request is already in asynchronous
modepublic AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) throws IllegalStateException
startAsync
in interface ServletRequest
servletRequest
- The ServletRequest with which to initialise the
asynchronous contextservletResponse
- The ServletResponse with which to initialise the
asynchronous contextIllegalStateException
- If asynchronous processing is not supported
for this request or if the request is already in asynchronous
modepublic 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)
wrapped
- The request to compare to the wrapped requesttrue
if the request wrapped by this wrapper (or
series of wrappers) is the same as the supplied request,
otherwise false
public boolean isWrapperFor(Class wrappedType)
wrappedType
- The class to compare to the class of the wrapped
requesttrue
if the request wrapped by this wrapper (or
series of wrappers) is the same type as the supplied type,
otherwise false
public DispatcherType getDispatcherType()
getDispatcherType
in interface ServletRequest
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.