java.lang.Object
jakarta.servlet.ServletRequestWrapper
- All Implemented Interfaces:
ServletRequest
- Direct Known Subclasses:
AsyncNonHttpDispatchWrapper
,HttpServletRequestWrapper
The ServletRequestWrapper API.
- Author:
- Manfred Riem ([email protected])
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the async context.getAttribute(String name)
Get the attribute.Returns the attribute names.Returns the character encoding.int
Returns the content length.long
Returns the content length.Returns the content type.Get the dispatcher type.Get the input stream.Returns the local address.Returns the locale.Returns the locales.Returns the local name.int
Returns the local port.getParameter(String name)
Get the parameter.Returns the parameter map.Returns the parameter names.String[]
getParameterValues(String name)
Get the parameter values.Returns the protocol.Get the reader.getRealPath(String path)
Deprecated.Returns the remote address.Returns the remote host.int
Returns the remote port.Returns the wrapped request.getRequestDispatcher(String path)
Returns the request dispatcher.Returns the scheme.Returns the server name.int
Returns the server port.Returns the servlet context.boolean
Is async started.boolean
Is async supported.boolean
isSecure()
Is secure.boolean
isWrapperFor(ServletRequest wrapped)
Is this a wrapper for the given request.boolean
isWrapperFor(Class<?> wrappedType)
Are we a wrapper for the given type.void
removeAttribute(String name)
Remove the attribute.void
setAttribute(String name, Object object)
Set the attribute.void
setCharacterEncoding(String characterEncoding)
Set the character encoding.void
setRequest(ServletRequest wrapped)
Set the wrapped request.Start async processing.startAsync(ServletRequest servletRequest, ServletResponse servletResponse)
Start async processing.
-
Constructor Details
-
ServletRequestWrapper
Constructor.- Parameters:
wrapped
- the wrapped request.
-
-
Method Details
-
getAsyncContext
Returns the async context.- Specified by:
getAsyncContext
in interfaceServletRequest
- Returns:
- the async context
-
getAttribute
Get the attribute.- Specified by:
getAttribute
in interfaceServletRequest
- Parameters:
name
- the name.- Returns:
- the value.
-
getAttributeNames
Returns the attribute names.- Specified by:
getAttributeNames
in interfaceServletRequest
- Returns:
- the attribute names
-
getCharacterEncoding
Returns the character encoding.- Specified by:
getCharacterEncoding
in interfaceServletRequest
- Returns:
- the character encoding
-
getContentLength
public int getContentLength()Returns the content length.- Specified by:
getContentLength
in interfaceServletRequest
- Returns:
- the content length
-
getContentLengthLong
public long getContentLengthLong()Returns the content length.- Specified by:
getContentLengthLong
in interfaceServletRequest
- Returns:
- the content length
-
getContentType
Returns the content type.- Specified by:
getContentType
in interfaceServletRequest
- Returns:
- the content type
-
getDispatcherType
Get the dispatcher type.- Specified by:
getDispatcherType
in interfaceServletRequest
- Returns:
- the dispatcher type
-
getInputStream
Get the input stream.- Specified by:
getInputStream
in interfaceServletRequest
- Returns:
- the input stream.
- Throws:
IOException
- when an I/O error occurs.
-
getLocalAddr
Returns the local address.- Specified by:
getLocalAddr
in interfaceServletRequest
- Returns:
- the local address
-
getLocalName
Returns the local name.- Specified by:
getLocalName
in interfaceServletRequest
- Returns:
- the local name
-
getLocalPort
public int getLocalPort()Returns the local port.- Specified by:
getLocalPort
in interfaceServletRequest
- Returns:
- the local port
-
getLocale
Returns the locale.- Specified by:
getLocale
in interfaceServletRequest
- Returns:
- the locale
-
getLocales
Returns the locales.- Specified by:
getLocales
in interfaceServletRequest
- Returns:
- the locales
-
getParameter
Get the parameter.- Specified by:
getParameter
in interfaceServletRequest
- Parameters:
name
- the name.- Returns:
- the value, or null if not found.
-
getParameterMap
Returns the parameter map.- Specified by:
getParameterMap
in interfaceServletRequest
- Returns:
- the parameter map
-
getParameterNames
Returns the parameter names.- Specified by:
getParameterNames
in interfaceServletRequest
- Returns:
- the parameter names
-
getParameterValues
Get the parameter values.- Specified by:
getParameterValues
in interfaceServletRequest
- Parameters:
name
- the name.- Returns:
- the values.
-
getProtocol
Returns the protocol.- Specified by:
getProtocol
in interfaceServletRequest
- Returns:
- the protocol
-
getReader
Get the reader.- Specified by:
getReader
in interfaceServletRequest
- Returns:
- the reader.
- Throws:
IOException
- when an I/O error occurs.
-
getRealPath
Deprecated.Returns the real path.- Specified by:
getRealPath
in interfaceServletRequest
- Parameters:
path
- the path.- Returns:
- the real path
-
getRemoteAddr
Returns the remote address.- Specified by:
getRemoteAddr
in interfaceServletRequest
- Returns:
- the remote address
-
getRemoteHost
Returns the remote host.- Specified by:
getRemoteHost
in interfaceServletRequest
- Returns:
- the remote host
-
getRemotePort
public int getRemotePort()Returns the remote port.- Specified by:
getRemotePort
in interfaceServletRequest
- Returns:
- the remote port
-
getRequest
Returns the wrapped request.- Returns:
- the wrapped request
-
getRequestDispatcher
Returns the request dispatcher.- Specified by:
getRequestDispatcher
in interfaceServletRequest
- Parameters:
path
- the path.- Returns:
- the request dispatcher
-
getScheme
Returns the scheme.- Specified by:
getScheme
in interfaceServletRequest
- Returns:
- the scheme
-
getServerName
Returns the server name.- Specified by:
getServerName
in interfaceServletRequest
- Returns:
- the server name
-
getServerPort
public int getServerPort()Returns the server port.- Specified by:
getServerPort
in interfaceServletRequest
- Returns:
- the server port
-
getServletContext
Returns the servlet context.- Specified by:
getServletContext
in interfaceServletRequest
- Returns:
- the servlet context
-
isAsyncStarted
public boolean isAsyncStarted()Is async started.- Specified by:
isAsyncStarted
in interfaceServletRequest
- Returns:
- true if async started, false otherwise.
-
isAsyncSupported
public boolean isAsyncSupported()Is async supported.- Specified by:
isAsyncSupported
in interfaceServletRequest
- Returns:
- true if async is supported, false otherwise.
-
isSecure
public boolean isSecure()Is secure.- Specified by:
isSecure
in interfaceServletRequest
- Returns:
- true if it is, false otherwise.
-
isWrapperFor
Is this a wrapper for the given request.- Parameters:
wrapped
- the wrapped request.- Returns:
- true if it is, false otherwise.
-
isWrapperFor
Are we a wrapper for the given type.- Parameters:
wrappedType
- the wrapped type.- Returns:
- true if we are, false otherwise.
-
removeAttribute
Remove the attribute.- Specified by:
removeAttribute
in interfaceServletRequest
- Parameters:
name
- the name.
-
setAttribute
Set the attribute.- Specified by:
setAttribute
in interfaceServletRequest
- Parameters:
name
- the name.object
- the object value.
-
setCharacterEncoding
Set the character encoding.- Specified by:
setCharacterEncoding
in interfaceServletRequest
- Parameters:
characterEncoding
- the character encoding.- Throws:
UnsupportedEncodingException
- when trying to set an unsupported character encoding.
-
setRequest
Set the wrapped request.- Parameters:
wrapped
- the wrapped request.
-
startAsync
Start async processing.- Specified by:
startAsync
in interfaceServletRequest
- Returns:
- the async context.
- Throws:
IllegalStateException
- when not allowed.
-
startAsync
public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) throws IllegalStateExceptionStart async processing.- Specified by:
startAsync
in interfaceServletRequest
- Parameters:
servletRequest
- the servlet request.servletResponse
- the servlet response.- Returns:
- the async context.
- Throws:
IllegalStateException
- when not able to start async processing.
-