|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjavax.servlet.ServletRequestWrapper
public class ServletRequestWrapper
Provides a convenient implementation of the ServletRequest interface that can be subclassed by developers wishing to adapt the request to a Servlet. This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped request object.
ServletRequest| 构造方法摘要 | |
|---|---|
ServletRequestWrapper(ServletRequest request)
Creates a ServletRequest adaptor wrapping the given request object. |
|
| 方法摘要 | |
|---|---|
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 |
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()
Gets the dispatcher type of the wrapped request. |
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)
已过时。 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. |
ServletRequest |
getRequest()
Return the wrapped request object. |
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()
Gets the servlet context to which the wrapped servlet request was last dispatched. |
boolean |
isAsyncStarted()
Checks if the wrapped request has been put into asynchronous mode. |
boolean |
isAsyncSupported()
Checks if the wrapped request supports asynchronous operation. |
boolean |
isSecure()
The default behavior of this method is to return isSecure() on the wrapped request object. |
boolean |
isWrapperFor(Class wrappedType)
Checks (recursively) if this ServletRequestWrapper wraps a ServletRequest of the given class type. |
boolean |
isWrapperFor(ServletRequest wrapped)
Checks (recursively) if this ServletRequestWrapper wraps the given ServletRequest instance. |
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 invoke ServletRequest.startAsync() on the wrapped request object. |
AsyncContext |
startAsync(ServletRequest servletRequest,
ServletResponse servletResponse)
The default behavior of this method is to invoke ServletRequest.startAsync(ServletRequest, ServletResponse)
on the wrapped request object. |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public ServletRequestWrapper(ServletRequest request)
IllegalArgumentException - if the request is null| 方法详细信息 |
|---|
public ServletRequest getRequest()
public void setRequest(ServletRequest request)
IllegalArgumentException - if the request is null.public Object getAttribute(String name)
ServletRequest 中的 getAttributename - a String specifying the name of
the attribute
Object containing the value
of the attribute, or null if
the attribute does not existpublic Enumeration<String> getAttributeNames()
ServletRequest 中的 getAttributeNamesEnumeration of strings
containing the names
of the request's attributespublic String getCharacterEncoding()
ServletRequest 中的 getCharacterEncodingString containing the name of
the character encoding, or null
if the request does not specify a character encoding
public void setCharacterEncoding(String enc)
throws UnsupportedEncodingException
ServletRequest 中的 setCharacterEncodingenc - String containing the name of
the character encoding.
UnsupportedEncodingException - if this
ServletRequest is still in a state where a
character encoding may be set, but the specified
encoding is invalidpublic int getContentLength()
ServletRequest 中的 getContentLengthpublic String getContentType()
ServletRequest 中的 getContentTypeString containing the name
of the MIME type of
the request, or null if the type is not known
public ServletInputStream getInputStream()
throws IOException
ServletRequest 中的 getInputStreamServletInputStream object containing
the body of the request
IOException - if an input or output exception occurredpublic String getParameter(String name)
ServletRequest 中的 getParametername - a String specifying the
name of the parameter
String representing the
single value of the parameterServletRequest.getParameterValues(java.lang.String)public Map<String,String[]> getParameterMap()
ServletRequest 中的 getParameterMappublic Enumeration<String> getParameterNames()
ServletRequest 中的 getParameterNamesEnumeration 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)
ServletRequest 中的 getParameterValuesname - a String containing the name of
the parameter whose value is requested
String objects
containing the parameter's valuesServletRequest.getParameter(java.lang.String)public String getProtocol()
ServletRequest 中的 getProtocolString containing the protocol
name and version numberpublic String getScheme()
ServletRequest 中的 getSchemeString containing the name
of the scheme used to make this requestpublic String getServerName()
ServletRequest 中的 getServerNameString containing the name
of the serverpublic int getServerPort()
ServletRequest 中的 getServerPort
public BufferedReader getReader()
throws IOException
ServletRequest 中的 getReaderBufferedReader
containing the body of the request
UnsupportedEncodingException - if the character set encoding
used is not supported and the
text cannot be decoded
IOException - if an input or output exception occurredServletRequest.getInputStream()public String getRemoteAddr()
ServletRequest 中的 getRemoteAddrString containing the
IP address of the client that sent the requestpublic String getRemoteHost()
ServletRequest 中的 getRemoteHostString containing the fully
qualified name of the client
public void setAttribute(String name,
Object o)
ServletRequest 中的 setAttributename - a String specifying
the name of the attributeo - the Object to be storedpublic void removeAttribute(String name)
ServletRequest 中的 removeAttributename - a String specifying
the name of the attribute to removepublic Locale getLocale()
ServletRequest 中的 getLocaleLocale for the clientpublic Enumeration<Locale> getLocales()
ServletRequest 中的 getLocalesEnumeration of preferred
Locale objects for the clientpublic boolean isSecure()
ServletRequest 中的 isSecurepublic RequestDispatcher getRequestDispatcher(String path)
ServletRequest 中的 getRequestDispatcherpath - 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
RequestDispatcherRequestDispatcher,
ServletContext.getRequestDispatcher(java.lang.String)public String getRealPath(String path)
ServletContext.getRealPath(java.lang.String) instead
ServletRequest 中的 getRealPathpublic int getRemotePort()
ServletRequest 中的 getRemotePortpublic String getLocalName()
ServletRequest 中的 getLocalNameString containing the host
name of the IP on which the request was received.public String getLocalAddr()
ServletRequest 中的 getLocalAddrString containing the
IP address on which the request was received.public int getLocalPort()
ServletRequest 中的 getLocalPortpublic ServletContext getServletContext()
ServletRequest 中的 getServletContext
public AsyncContext startAsync()
throws IllegalStateException
ServletRequest.startAsync() on the wrapped request object.
ServletRequest 中的 startAsyncIllegalStateException - 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 AsyncContext startAsync(ServletRequest servletRequest,
ServletResponse servletResponse)
throws IllegalStateException
ServletRequest.startAsync(ServletRequest, ServletResponse)
on the wrapped request object.
ServletRequest 中的 startAsyncservletRequest - the ServletRequest used to initialize the
AsyncContextservletResponse - the ServletResponse used to initialize the
AsyncContext
IllegalStateException - 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()
ServletRequest 中的 isAsyncStartedServletRequest.isAsyncStarted()public boolean isAsyncSupported()
ServletRequest 中的 isAsyncSupportedServletRequest.isAsyncSupported()public AsyncContext getAsyncContext()
startAsync() or
startAsync(ServletRequest,ServletResponse) on the wrapped
request.
ServletRequest 中的 getAsyncContextstartAsync() or
startAsync(ServletRequest,ServletResponse) on
the wrapped request
IllegalStateException - 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(ServletRequest wrapped)
ServletRequest instance.
wrapped - the ServletRequest instance to search for
public boolean isWrapperFor(Class wrappedType)
ServletRequest of the given class type.
wrappedType - the ServletRequest class type to
search for
IllegalArgumentException - if the given class does not
implement ServletRequestpublic DispatcherType getDispatcherType()
ServletRequest 中的 getDispatcherTypeServletRequest.getDispatcherType()
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||