Top Description Fields Constructors Methods
jakarta.servlet

public Class ServletRequestWrapper

extends Object
implements ServletRequest
Class Inheritance
All Implemented Interfaces
jakarta.servlet.ServletRequest
Known Direct Subclasses
jakarta.servlet.http.HttpServletRequestWrapper
Imports
java.io.BufferedReader, .IOException, .UnsupportedEncodingException, java.nio.charset.Charset, java.util.Enumeration, .Locale, .Map

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.
Since
Servlet 2.3
See Also
jakarta.servlet.ServletRequest

Field Summary

Modifier and TypeField and Description
private ServletRequest

Constructor Summary

AccessConstructor and Description
public
ServletRequestWrapper(ServletRequest
the ServletRequest to be wrapped
request
)

Creates a ServletRequest adaptor wrapping the given request object.

Method Summary

Modifier and TypeMethod and Description
public AsyncContext

Returns:

the AsyncContext that was created or reinitialized by the most recent invocation of startAsync or startAsync(ServletRequest, ServletResponse) on the wrapped request
getAsyncContext
()

Implements jakarta.servlet.ServletRequest.getAsyncContext.

Gets the AsyncContext that was created or reinitialized by the most recent invocation of startAsync or startAsync(ServletRequest, ServletResponse) on the wrapped request.

public Object
getAttribute(String
a String specifying the name of the attribute
name
)

Implements jakarta.servlet.ServletRequest.getAttribute.

The default behavior of this method is to call getAttribute(String name) on the wrapped request object.

public Enumeration<String>
getAttributeNames()

Implements jakarta.servlet.ServletRequest.getAttributeNames.

The default behavior of this method is to return getAttributeNames() on the wrapped request object.

public String
getCharacterEncoding()

Implements jakarta.servlet.ServletRequest.getCharacterEncoding.

The default behavior of this method is to return getCharacterEncoding() on the wrapped request object.

public int
getContentLength()

Implements jakarta.servlet.ServletRequest.getContentLength.

The default behavior of this method is to return getContentLength() on the wrapped request object.

public long
getContentLengthLong()

Implements jakarta.servlet.ServletRequest.getContentLengthLong.

The default behavior of this method is to return getContentLengthLong() on the wrapped request object.

public String
getContentType()

Implements jakarta.servlet.ServletRequest.getContentType.

The default behavior of this method is to return getContentType() on the wrapped request object.

public DispatcherType

Returns:

the dispatcher type of the wrapped request
getDispatcherType
()

Implements jakarta.servlet.ServletRequest.getDispatcherType.

Gets the dispatcher type of the wrapped request.

public ServletInputStream
getInputStream()

Implements jakarta.servlet.ServletRequest.getInputStream.

The default behavior of this method is to return getInputStream() on the wrapped request object.

public String
getLocalAddr()

Implements jakarta.servlet.ServletRequest.getLocalAddr.

The default behavior of this method is to return getLocalAddr() on the wrapped request object.

public Locale
getLocale()

Implements jakarta.servlet.ServletRequest.getLocale.

The default behavior of this method is to return getLocale() on the wrapped request object.

public Enumeration<Locale>
getLocales()

Implements jakarta.servlet.ServletRequest.getLocales.

The default behavior of this method is to return getLocales() on the wrapped request object.

public String
getLocalName()

Implements jakarta.servlet.ServletRequest.getLocalName.

The default behavior of this method is to return getLocalName() on the wrapped request object.

public int
getLocalPort()

Implements jakarta.servlet.ServletRequest.getLocalPort.

The default behavior of this method is to return getLocalPort() on the wrapped request object.

public String
getParameter(String
a String specifying the name of the parameter
name
)

Implements jakarta.servlet.ServletRequest.getParameter.

The default behavior of this method is to return getParameter(String name) on the wrapped request object.

public Map<String, String[]>
getParameterMap()

Implements jakarta.servlet.ServletRequest.getParameterMap.

The default behavior of this method is to return getParameterMap() on the wrapped request object.

public Enumeration<String>
getParameterNames()

Implements jakarta.servlet.ServletRequest.getParameterNames.

The default behavior of this method is to return getParameterNames() on the wrapped request object.

public String[]
getParameterValues(String
a String containing the name of the parameter whose value is requested
name
)

Implements jakarta.servlet.ServletRequest.getParameterValues.

The default behavior of this method is to return getParameterValues(String name) on the wrapped request object.

public String
getProtocol()

Implements jakarta.servlet.ServletRequest.getProtocol.

The default behavior of this method is to return getProtocol() on the wrapped request object.

public String

Returns:

the protocol defined request ID, if any, for the wrapped request
getProtocolRequestId
()

Implements jakarta.servlet.ServletRequest.getProtocolRequestId.

Gets the protocol defined request ID, if any, for the wrapped request.

public BufferedReader
getReader()

Implements jakarta.servlet.ServletRequest.getReader.

The default behavior of this method is to return getReader() on the wrapped request object.

public String
getRemoteAddr()

Implements jakarta.servlet.ServletRequest.getRemoteAddr.

The default behavior of this method is to return getRemoteAddr() on the wrapped request object.

public String
getRemoteHost()

Implements jakarta.servlet.ServletRequest.getRemoteHost.

The default behavior of this method is to return getRemoteHost() on the wrapped request object.

public int
getRemotePort()

Implements jakarta.servlet.ServletRequest.getRemotePort.

The default behavior of this method is to return getRemotePort() on the wrapped request object.

public ServletRequest

Returns:

the wrapped ServletRequest
getRequest
()

Return the wrapped request object.

public RequestDispatcher
getRequestDispatcher(String
a String specifying the pathname to the resource. If it is relative, it must be relative against the current servlet.
path
)

Implements jakarta.servlet.ServletRequest.getRequestDispatcher.

The default behavior of this method is to return getRequestDispatcher(String path) on the wrapped request object.

public String

Returns:

the request ID for the wrapped request
getRequestId
()

Implements jakarta.servlet.ServletRequest.getRequestId.

Gets the request ID for the wrapped request.

public String
getScheme()

Implements jakarta.servlet.ServletRequest.getScheme.

The default behavior of this method is to return getScheme() on the wrapped request object.

public String
getServerName()

Implements jakarta.servlet.ServletRequest.getServerName.

The default behavior of this method is to return getServerName() on the wrapped request object.

public int
getServerPort()

Implements jakarta.servlet.ServletRequest.getServerPort.

The default behavior of this method is to return getServerPort() on the wrapped request object.

public ServletConnection

Returns:

the connection information for the wrapped request
getServletConnection
()

Implements jakarta.servlet.ServletRequest.getServletConnection.

Gets the connection information for the wrapped request.

public ServletContext

Returns:

the servlet context to which the wrapped servlet request was last dispatched
getServletContext
()

Implements jakarta.servlet.ServletRequest.getServletContext.

Gets the servlet context to which the wrapped servlet request was last dispatched.

public boolean

Returns:

true if this request has been put into asynchronous mode, false otherwise
isAsyncStarted
()

Implements jakarta.servlet.ServletRequest.isAsyncStarted.

Checks if the wrapped request has been put into asynchronous mode.

public boolean

Returns:

true if this request supports asynchronous operation, false otherwise
isAsyncSupported
()

Implements jakarta.servlet.ServletRequest.isAsyncSupported.

Checks if the wrapped request supports asynchronous operation.

public boolean
isSecure()

Implements jakarta.servlet.ServletRequest.isSecure.

The default behavior of this method is to return isSecure() on the wrapped request object.

public boolean

Returns:

true if this ServletRequestWrapper wraps the given ServletRequest instance, false otherwise
isWrapperFor
(ServletRequest
the ServletRequest instance to search for
wrapped
)

Checks (recursively) if this ServletRequestWrapper wraps the given ServletRequest instance.

public boolean

Returns:

true if this ServletRequestWrapper wraps a ServletRequest of the given class type, false otherwise
isWrapperFor
(Class<?>
the ServletRequest class type to search for
wrappedType
)

Checks (recursively) if this ServletRequestWrapper wraps a ServletRequest of the given class type.

public void
removeAttribute(String
a String specifying the name of the attribute to remove
name
)

Implements jakarta.servlet.ServletRequest.removeAttribute.

The default behavior of this method is to call removeAttribute(String name) on the wrapped request object.

public void
setAttribute(String
a String specifying the name of the attribute
name
,
Object
the Object to be stored
o
)

Implements jakarta.servlet.ServletRequest.setAttribute.

The default behavior of this method is to return setAttribute(String name, Object o) on the wrapped request object.

public void
setCharacterEncoding(String
String containing the name of the character encoding.
encoding
)

Implements jakarta.servlet.ServletRequest.setCharacterEncoding.

The default behavior of this method is to set the character encoding on the wrapped request object.

public void
setCharacterEncoding(Charset
Charset representing the character encoding.
encoding
)

Overrides default jakarta.servlet.ServletRequest.setCharacterEncoding.

The default behavior of this method is to set the character encoding on the wrapped request object.

public void
setRequest(ServletRequest
the ServletRequest to be installed
request
)

Sets the request object being wrapped.

public AsyncContext

Returns:

the (re)initialized AsyncContext
startAsync
()

Implements jakarta.servlet.ServletRequest.startAsync.

The default behavior of this method is to invoke ServletRequest#startAsync on the wrapped request object.

public AsyncContext

Returns:

the (re)initialized AsyncContext
startAsync
(ServletRequest
the ServletRequest used to initialize the AsyncContext
servletRequest
,
ServletResponse
the ServletResponse used to initialize the AsyncContext
servletResponse
)

Implements jakarta.servlet.ServletRequest.startAsync.

The default behavior of this method is to invoke ServletRequest#startAsync(ServletRequest, ServletResponse) on the wrapped request object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

requestback to summary
private ServletRequest request

Constructor Detail

ServletRequestWrapperback to summary
public ServletRequestWrapper(ServletRequest request)

Creates a ServletRequest adaptor wrapping the given request object.

Parameters
request:ServletRequest

the ServletRequest to be wrapped

Exceptions
IllegalArgumentException:
if the request is null

Method Detail

getAsyncContextback to summary
public AsyncContext getAsyncContext()

Implements jakarta.servlet.ServletRequest.getAsyncContext.

Gets the AsyncContext that was created or reinitialized by the most recent invocation of startAsync or startAsync(ServletRequest, ServletResponse) on the wrapped request.

Returns:AsyncContext

the AsyncContext that was created or reinitialized by the most recent invocation of startAsync or startAsync(ServletRequest, ServletResponse) on the wrapped request

Annotations
@Override
Exceptions
IllegalStateException:
if this request has not been put into asynchronous mode, i.e., if neither startAsync nor startAsync(ServletRequest, ServletResponse) has been called
Since
Servlet 3.0
See Also
ServletRequest#getAsyncContext
getAttributeback to summary
public Object getAttribute(String name)

Implements jakarta.servlet.ServletRequest.getAttribute.

The default behavior of this method is to call getAttribute(String name) on the wrapped request object.

Parameters
name:String

Doc from jakarta.servlet.ServletRequest.getAttribute.

a String specifying the name of the attribute

Returns:Object

Doc from jakarta.servlet.ServletRequest.getAttribute.

an Object containing the value of the attribute, or null if the attribute does not exist

Annotations
@Override
getAttributeNamesback to summary
public Enumeration<String> getAttributeNames()

Implements jakarta.servlet.ServletRequest.getAttributeNames.

The default behavior of this method is to return getAttributeNames() on the wrapped request object.

Returns:Enumeration<String>

Doc from jakarta.servlet.ServletRequest.getAttributeNames.

an Enumeration of strings containing the names of the request's attributes

Annotations
@Override
getCharacterEncodingback to summary
public String getCharacterEncoding()

Implements jakarta.servlet.ServletRequest.getCharacterEncoding.

The default behavior of this method is to return getCharacterEncoding() on the wrapped request object.

Returns:String

Doc from jakarta.servlet.ServletRequest.getCharacterEncoding.

a String containing the name of the character encoding, or null if the request does not specify a character encoding

Annotations
@Override
getContentLengthback to summary
public int getContentLength()

Implements jakarta.servlet.ServletRequest.getContentLength.

The default behavior of this method is to return getContentLength() on the wrapped request object.

Returns:int

Doc from jakarta.servlet.ServletRequest.getContentLength.

an integer containing the length of the request body or -1 if the length is not known or is greater than Integer.MAX_VALUE.

Annotations
@Override
getContentLengthLongback to summary
public long getContentLengthLong()

Implements jakarta.servlet.ServletRequest.getContentLengthLong.

The default behavior of this method is to return getContentLengthLong() on the wrapped request object.

Returns:long

Doc from jakarta.servlet.ServletRequest.getContentLengthLong.

a long containing the length of the request body or -1L if the length is not known

Annotations
@Override
Since
Servlet 3.1
getContentTypeback to summary
public String getContentType()

Implements jakarta.servlet.ServletRequest.getContentType.

The default behavior of this method is to return getContentType() on the wrapped request object.

Returns:String

Doc from jakarta.servlet.ServletRequest.getContentType.

a String containing the name of the MIME type of the request, or null if the type is not known

Annotations
@Override
getDispatcherTypeback to summary
public DispatcherType getDispatcherType()

Implements jakarta.servlet.ServletRequest.getDispatcherType.

Gets the dispatcher type of the wrapped request.

Returns:DispatcherType

the dispatcher type of the wrapped request

Annotations
@Override
Since
Servlet 3.0
See Also
ServletRequest#getDispatcherType
getInputStreamback to summary
public ServletInputStream getInputStream() throws IOException

Implements jakarta.servlet.ServletRequest.getInputStream.

The default behavior of this method is to return getInputStream() on the wrapped request object.

Returns:ServletInputStream

Doc from jakarta.servlet.ServletRequest.getInputStream.

a ServletInputStream object containing the body of the request

Annotations
@Override
Exceptions
IOException:

Doc from jakarta.servlet.ServletRequest.getInputStream.

if an input or output exception occurred

getLocalAddrback to summary
public String getLocalAddr()

Implements jakarta.servlet.ServletRequest.getLocalAddr.

The default behavior of this method is to return getLocalAddr() on the wrapped request object.

Returns:String

Doc from jakarta.servlet.ServletRequest.getLocalAddr.

a String containing an IP address.

Annotations
@Override
Since
Servlet 2.4
getLocaleback to summary
public Locale getLocale()

Implements jakarta.servlet.ServletRequest.getLocale.

The default behavior of this method is to return getLocale() on the wrapped request object.

Returns:Locale

Doc from jakarta.servlet.ServletRequest.getLocale.

the preferred Locale for the client

Annotations
@Override
getLocalesback to summary
public Enumeration<Locale> getLocales()

Implements jakarta.servlet.ServletRequest.getLocales.

The default behavior of this method is to return getLocales() on the wrapped request object.

Returns:Enumeration<Locale>

Doc from jakarta.servlet.ServletRequest.getLocales.

an Enumeration of preferred Locale objects for the client

Annotations
@Override
getLocalNameback to summary
public String getLocalName()

Implements jakarta.servlet.ServletRequest.getLocalName.

The default behavior of this method is to return getLocalName() on the wrapped request object.

Returns:String

Doc from jakarta.servlet.ServletRequest.getLocalName.

a String containing the host name of the IP on which the request was received.

Annotations
@Override
Since
Servlet 2.4
getLocalPortback to summary
public int getLocalPort()

Implements jakarta.servlet.ServletRequest.getLocalPort.

The default behavior of this method is to return getLocalPort() on the wrapped request object.

Returns:int

Doc from jakarta.servlet.ServletRequest.getLocalPort.

an integer specifying a port number

Annotations
@Override
Since
Servlet 2.4
getParameterback to summary
public String getParameter(String name)

Implements jakarta.servlet.ServletRequest.getParameter.

The default behavior of this method is to return getParameter(String name) on the wrapped request object.

Parameters
name:String

Doc from jakarta.servlet.ServletRequest.getParameter.

a String specifying the name of the parameter

Returns:String

Doc from jakarta.servlet.ServletRequest.getParameter.

a String representing the single value of the parameter

Annotations
@Override
getParameterMapback to summary
public Map<String, String[]> getParameterMap()

Implements jakarta.servlet.ServletRequest.getParameterMap.

The default behavior of this method is to return getParameterMap() on the wrapped request object.

Returns:Map<String, String[]>

Doc from jakarta.servlet.ServletRequest.getParameterMap.

an immutable java.util.Map containing parameter names as keys and parameter values as map values. The keys in the parameter map are of type String. The values in the parameter map are of type String array.

Annotations
@Override
getParameterNamesback to summary
public Enumeration<String> getParameterNames()

Implements jakarta.servlet.ServletRequest.getParameterNames.

The default behavior of this method is to return getParameterNames() on the wrapped request object.

Returns:Enumeration<String>

Doc from jakarta.servlet.ServletRequest.getParameterNames.

an Enumeration of String objects, each String containing the name of a request parameter; or an empty Enumeration if the request has no parameters

Annotations
@Override
getParameterValuesback to summary
public String[] getParameterValues(String name)

Implements jakarta.servlet.ServletRequest.getParameterValues.

The default behavior of this method is to return getParameterValues(String name) on the wrapped request object.

Parameters
name:String

Doc from jakarta.servlet.ServletRequest.getParameterValues.

a String containing the name of the parameter whose value is requested

Returns:String[]

Doc from jakarta.servlet.ServletRequest.getParameterValues.

an array of String objects containing the parameter's values

Annotations
@Override
getProtocolback to summary
public String getProtocol()

Implements jakarta.servlet.ServletRequest.getProtocol.

The default behavior of this method is to return getProtocol() on the wrapped request object.

Returns:String

Doc from jakarta.servlet.ServletRequest.getProtocol.

a String containing the protocol name and version number

Annotations
@Override
getProtocolRequestIdback to summary
public String getProtocolRequestId()

Implements jakarta.servlet.ServletRequest.getProtocolRequestId.

Gets the protocol defined request ID, if any, for the wrapped request.

Returns:String

the protocol defined request ID, if any, for the wrapped request

Annotations
@Override
Since
Servlet 6.0
getReaderback to summary
public BufferedReader getReader() throws IOException

Implements jakarta.servlet.ServletRequest.getReader.

The default behavior of this method is to return getReader() on the wrapped request object.

Returns:BufferedReader

Doc from jakarta.servlet.ServletRequest.getReader.

a BufferedReader containing the body of the request

Annotations
@Override
Exceptions
IOException:

Doc from jakarta.servlet.ServletRequest.getReader.

if an input or output exception occurred

getRemoteAddrback to summary
public String getRemoteAddr()

Implements jakarta.servlet.ServletRequest.getRemoteAddr.

The default behavior of this method is to return getRemoteAddr() on the wrapped request object.

Returns:String

Doc from jakarta.servlet.ServletRequest.getRemoteAddr.

a String containing an IP address

Annotations
@Override
getRemoteHostback to summary
public String getRemoteHost()

Implements jakarta.servlet.ServletRequest.getRemoteHost.

The default behavior of this method is to return getRemoteHost() on the wrapped request object.

Returns:String

Doc from jakarta.servlet.ServletRequest.getRemoteHost.

a String containing a fully qualified name or IP address.

Annotations
@Override
getRemotePortback to summary
public int getRemotePort()

Implements jakarta.servlet.ServletRequest.getRemotePort.

The default behavior of this method is to return getRemotePort() on the wrapped request object.

Returns:int

Doc from jakarta.servlet.ServletRequest.getRemotePort.

an integer specifying the port number

Annotations
@Override
Since
Servlet 2.4
getRequestback to summary
public ServletRequest getRequest()

Return the wrapped request object.

Returns:ServletRequest

the wrapped ServletRequest

getRequestDispatcherback to summary
public RequestDispatcher getRequestDispatcher(String path)

Implements jakarta.servlet.ServletRequest.getRequestDispatcher.

The default behavior of this method is to return getRequestDispatcher(String path) on the wrapped request object.

Parameters
path:String

Doc from jakarta.servlet.ServletRequest.getRequestDispatcher.

a String specifying the pathname to the resource. If it is relative, it must be relative against the current servlet.

Returns:RequestDispatcher

Doc from jakarta.servlet.ServletRequest.getRequestDispatcher.

a RequestDispatcher object that acts as a wrapper for the resource at the specified path, or null if the servlet container cannot return a RequestDispatcher

Annotations
@Override
getRequestIdback to summary
public String getRequestId()

Implements jakarta.servlet.ServletRequest.getRequestId.

Gets the request ID for the wrapped request.

Returns:String

the request ID for the wrapped request

Annotations
@Override
Since
Servlet 6.0
getSchemeback to summary
public String getScheme()

Implements jakarta.servlet.ServletRequest.getScheme.

The default behavior of this method is to return getScheme() on the wrapped request object.

Returns:String

Doc from jakarta.servlet.ServletRequest.getScheme.

a String containing the name of the scheme used to make this request

Annotations
@Override
getServerNameback to summary
public String getServerName()

Implements jakarta.servlet.ServletRequest.getServerName.

The default behavior of this method is to return getServerName() on the wrapped request object.

Returns:String

Doc from jakarta.servlet.ServletRequest.getServerName.

a String containing the name of the server

Annotations
@Override
getServerPortback to summary
public int getServerPort()

Implements jakarta.servlet.ServletRequest.getServerPort.

The default behavior of this method is to return getServerPort() on the wrapped request object.

Returns:int

Doc from jakarta.servlet.ServletRequest.getServerPort.

an integer specifying the port number

Annotations
@Override
getServletConnectionback to summary
public ServletConnection getServletConnection()

Implements jakarta.servlet.ServletRequest.getServletConnection.

Gets the connection information for the wrapped request.

Returns:ServletConnection

the connection information for the wrapped request

Annotations
@Override
Since
Servlet 6.0
getServletContextback to summary
public ServletContext getServletContext()

Implements jakarta.servlet.ServletRequest.getServletContext.

Gets the servlet context to which the wrapped servlet request was last dispatched.

Returns:ServletContext

the servlet context to which the wrapped servlet request was last dispatched

Annotations
@Override
Since
Servlet 3.0
isAsyncStartedback to summary
public boolean isAsyncStarted()

Implements jakarta.servlet.ServletRequest.isAsyncStarted.

Checks if the wrapped request has been put into asynchronous mode.

Returns:boolean

true if this request has been put into asynchronous mode, false otherwise

Annotations
@Override
Since
Servlet 3.0
See Also
ServletRequest#isAsyncStarted
isAsyncSupportedback to summary
public boolean isAsyncSupported()

Implements jakarta.servlet.ServletRequest.isAsyncSupported.

Checks if the wrapped request supports asynchronous operation.

Returns:boolean

true if this request supports asynchronous operation, false otherwise

Annotations
@Override
Since
Servlet 3.0
See Also
ServletRequest#isAsyncSupported
isSecureback to summary
public boolean isSecure()

Implements jakarta.servlet.ServletRequest.isSecure.

The default behavior of this method is to return isSecure() on the wrapped request object.

Returns:boolean

Doc from jakarta.servlet.ServletRequest.isSecure.

a boolean indicating if the request was made using a secure channel

Annotations
@Override
isWrapperForback to summary
public boolean isWrapperFor(ServletRequest wrapped)

Checks (recursively) if this ServletRequestWrapper wraps the given ServletRequest instance.

Parameters
wrapped:ServletRequest

the ServletRequest instance to search for

Returns:boolean

true if this ServletRequestWrapper wraps the given ServletRequest instance, false otherwise

Since
Servlet 3.0
isWrapperForback to summary
public boolean isWrapperFor(Class<?> wrappedType)

Checks (recursively) if this ServletRequestWrapper wraps a ServletRequest of the given class type.

Parameters
wrappedType:Class<?>

the ServletRequest class type to search for

Returns:boolean

true if this ServletRequestWrapper wraps a ServletRequest of the given class type, false otherwise

Exceptions
IllegalArgumentException:
if the given class does not implement ServletRequest
Since
Servlet 3.0
removeAttributeback to summary
public void removeAttribute(String name)

Implements jakarta.servlet.ServletRequest.removeAttribute.

The default behavior of this method is to call removeAttribute(String name) on the wrapped request object.

Parameters
name:String

Doc from jakarta.servlet.ServletRequest.removeAttribute.

a String specifying the name of the attribute to remove

Annotations
@Override
setAttributeback to summary
public void setAttribute(String name, Object o)

Implements jakarta.servlet.ServletRequest.setAttribute.

The default behavior of this method is to return setAttribute(String name, Object o) on the wrapped request object.

Parameters
name:String

Doc from jakarta.servlet.ServletRequest.setAttribute.

a String specifying the name of the attribute

o:Object

Doc from jakarta.servlet.ServletRequest.setAttribute.

the Object to be stored

Annotations
@Override
setCharacterEncodingback to summary
public void setCharacterEncoding(String encoding) throws UnsupportedEncodingException

Implements jakarta.servlet.ServletRequest.setCharacterEncoding.

The default behavior of this method is to set the character encoding on the wrapped request object.

Parameters
encoding:String

Doc from jakarta.servlet.ServletRequest.setCharacterEncoding.

String containing the name of the character encoding.

Annotations
@Override
Exceptions
UnsupportedEncodingException:

Doc from jakarta.servlet.ServletRequest.setCharacterEncoding.

if this ServletRequest is still in a state where a character encoding may be set, but the specified encoding is invalid

setCharacterEncodingback to summary
public void setCharacterEncoding(Charset encoding)

Overrides default jakarta.servlet.ServletRequest.setCharacterEncoding.

The default behavior of this method is to set the character encoding on the wrapped request object.

Parameters
encoding:Charset

Doc from jakarta.servlet.ServletRequest.setCharacterEncoding.

Charset representing the character encoding.

Annotations
@Override
Since
Servlet 6.1
setRequestback to summary
public void setRequest(ServletRequest request)

Sets the request object being wrapped.

Parameters
request:ServletRequest

the ServletRequest to be installed

Exceptions
IllegalArgumentException:
if the request is null.
startAsyncback to summary
public AsyncContext startAsync() throws IllegalStateException

Implements jakarta.servlet.ServletRequest.startAsync.

The default behavior of this method is to invoke ServletRequest#startAsync on the wrapped request object.

Returns:AsyncContext

the (re)initialized AsyncContext

Annotations
@Override
Exceptions
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 closed
Since
Servlet 3.0
See Also
ServletRequest#startAsync
startAsyncback to summary
public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) throws IllegalStateException

Implements jakarta.servlet.ServletRequest.startAsync.

The default behavior of this method is to invoke ServletRequest#startAsync(ServletRequest, ServletResponse) on the wrapped request object.

Parameters
servletRequest:ServletRequest

the ServletRequest used to initialize the AsyncContext

servletResponse:ServletResponse

the ServletResponse used to initialize the AsyncContext

Returns:AsyncContext

the (re)initialized AsyncContext

Annotations
@Override
Exceptions
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 closed
Since
Servlet 3.0
See Also
ServletRequest#startAsync(ServletRequest, ServletResponse)