Module cloud.piranha.extension.weld
Package cloud.piranha.extension.weld
Class RealtimeHttpServletRequestWrapper
java.lang.Object
cloud.piranha.extension.weld.RealtimeHttpServletRequestWrapper
- All Implemented Interfaces:
jakarta.servlet.http.HttpServletRequest
,jakarta.servlet.ServletRequest
- Direct Known Subclasses:
WeldHttpServletRequest
public abstract class RealtimeHttpServletRequestWrapper
extends Object
implements jakarta.servlet.http.HttpServletRequest
An HttpServletRequest wrapper that consistently consults the getWrapped() method for every operation.
- Author:
- Arjan Tijms, Manfred Riem ([email protected])
-
Field Summary
Fields inherited from interface jakarta.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
authenticate
(jakarta.servlet.http.HttpServletResponse response) Authenticate the request.Change the session id.jakarta.servlet.AsyncContext
Returns the async context.getAttribute
(String name) Get the attribute.Returns the attribute names.Returns the auth type.Returns the character encoding.int
Returns the content length.long
Returns the content length.Returns the content type.Returns the context path.jakarta.servlet.http.Cookie[]
Get the cookies.long
getDateHeader
(String name) Get the date header.jakarta.servlet.DispatcherType
Get the dispatcher type.Get the header.Returns the header names.getHeaders
(String name) Get the headers.jakarta.servlet.ServletInputStream
Returns the input stream.int
getIntHeader
(String name) Get the int header.Returns the local address.Returns the locale.Returns the locales.Returns the local name.int
Returns the local port.Returns the method.getParameter
(String name) Get the parameter.Returns the parameter map.Returns the parameter names.String[]
getParameterValues
(String name) Get the parameter values.jakarta.servlet.http.Part
Get the part.Collection<jakarta.servlet.http.Part>
getParts()
Get the parts.Returns the path info.Returns the path translated.Returns the protocol.Returns the query string.Get the reader.Returns the remote address.Returns the remote host.int
Returns the remote port.Returns the remote user.jakarta.servlet.ServletRequest
Returns the wrapped request.jakarta.servlet.RequestDispatcher
getRequestDispatcher
(String path) Returns the request dispatcher.Returns the requested session id.Returns the request URI.Returns the request URL.Returns the scheme.Returns the server name.int
Returns the server port.jakarta.servlet.ServletContext
Returns the servlet context.Returns the servlet path.jakarta.servlet.http.HttpSession
Returns the HTTP session.jakarta.servlet.http.HttpSession
getSession
(boolean create) Get the HTTP session.Returns the user principal.protected abstract jakarta.servlet.http.HttpServletRequest
Returns the wrapped request.boolean
Is async started.boolean
Is async supported.boolean
Is the requested session id from a cookie.boolean
Is the requested session id from a URL.boolean
Is the requested session id valid.boolean
isSecure()
Is secure.boolean
isUserInRole
(String role) Is the user in the role.boolean
isWrapperFor
(jakarta.servlet.ServletRequest wrapped) Is this a wrapper for the given request.boolean
isWrapperFor
(Class<?> wrappedType) Are we a wrapper for the given type.void
Login.void
logout()
Logout.void
removeAttribute
(String name) Remove the attribute.void
setAttribute
(String name, Object object) Set the attribute.void
setCharacterEncoding
(String characterEncoding) Set the character encoding.jakarta.servlet.AsyncContext
Start async processing.jakarta.servlet.AsyncContext
startAsync
(jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse) Start async processing.<T extends jakarta.servlet.http.HttpUpgradeHandler>
TUpgrade the request.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface jakarta.servlet.http.HttpServletRequest
getHttpServletMapping, getTrailerFields, isTrailerFieldsReady, newPushBuilder
Methods inherited from interface jakarta.servlet.ServletRequest
getProtocolRequestId, getRequestId, getServletConnection
-
Constructor Details
-
RealtimeHttpServletRequestWrapper
public RealtimeHttpServletRequestWrapper()
-
-
Method Details
-
getAsyncContext
public jakarta.servlet.AsyncContext getAsyncContext()Returns the async context.- Specified by:
getAsyncContext
in interfacejakarta.servlet.ServletRequest
- Returns:
- the async context
-
getAttribute
Get the attribute.- Specified by:
getAttribute
in interfacejakarta.servlet.ServletRequest
- Parameters:
name
- the name.- Returns:
- the value.
-
getAttributeNames
Returns the attribute names.- Specified by:
getAttributeNames
in interfacejakarta.servlet.ServletRequest
- Returns:
- the attribute names
-
getCharacterEncoding
Returns the character encoding.- Specified by:
getCharacterEncoding
in interfacejakarta.servlet.ServletRequest
- Returns:
- the character encoding
-
getContentLength
public int getContentLength()Returns the content length.- Specified by:
getContentLength
in interfacejakarta.servlet.ServletRequest
- Returns:
- the content length
-
getContentLengthLong
public long getContentLengthLong()Returns the content length.- Specified by:
getContentLengthLong
in interfacejakarta.servlet.ServletRequest
- Returns:
- the content length
-
getContentType
Returns the content type.- Specified by:
getContentType
in interfacejakarta.servlet.ServletRequest
- Returns:
- the content type
-
getDispatcherType
public jakarta.servlet.DispatcherType getDispatcherType()Get the dispatcher type.- Specified by:
getDispatcherType
in interfacejakarta.servlet.ServletRequest
-
getInputStream
Returns the input stream.- Specified by:
getInputStream
in interfacejakarta.servlet.ServletRequest
- Returns:
- the input stream
- Throws:
IOException
- when an I/O error occurs.
-
getLocalAddr
Returns the local address.- Specified by:
getLocalAddr
in interfacejakarta.servlet.ServletRequest
- Returns:
- the local address
-
getLocalName
Returns the local name.- Specified by:
getLocalName
in interfacejakarta.servlet.ServletRequest
- Returns:
- the local name
-
getLocalPort
public int getLocalPort()Returns the local port.- Specified by:
getLocalPort
in interfacejakarta.servlet.ServletRequest
- Returns:
- the local port
-
getLocale
Returns the locale.- Specified by:
getLocale
in interfacejakarta.servlet.ServletRequest
- Returns:
- the locale
-
getLocales
Returns the locales.- Specified by:
getLocales
in interfacejakarta.servlet.ServletRequest
- Returns:
- the locales
-
getParameter
Get the parameter.- Specified by:
getParameter
in interfacejakarta.servlet.ServletRequest
- Parameters:
name
- the name.- Returns:
- the value, or null if not found.
-
getParameterMap
Returns the parameter map.- Specified by:
getParameterMap
in interfacejakarta.servlet.ServletRequest
- Returns:
- the parameter map
-
getParameterNames
Returns the parameter names.- Specified by:
getParameterNames
in interfacejakarta.servlet.ServletRequest
- Returns:
- the parameter names
-
getParameterValues
Get the parameter values.- Specified by:
getParameterValues
in interfacejakarta.servlet.ServletRequest
- Parameters:
name
- the name.- Returns:
- the values.
-
getProtocol
Returns the protocol.- Specified by:
getProtocol
in interfacejakarta.servlet.ServletRequest
- Returns:
- the protocol
-
getReader
Get the reader.- Specified by:
getReader
in interfacejakarta.servlet.ServletRequest
- Returns:
- the reader.
- Throws:
IOException
- when an I/O error occurs.
-
getRemoteAddr
Returns the remote address.- Specified by:
getRemoteAddr
in interfacejakarta.servlet.ServletRequest
- Returns:
- the remote address
-
getRemoteHost
Returns the remote host.- Specified by:
getRemoteHost
in interfacejakarta.servlet.ServletRequest
- Returns:
- the remote host
-
getRemotePort
public int getRemotePort()Returns the remote port.- Specified by:
getRemotePort
in interfacejakarta.servlet.ServletRequest
- Returns:
- the remote port
-
getRequest
public jakarta.servlet.ServletRequest getRequest()Returns the wrapped request.- Returns:
- the wrapped request
-
getRequestDispatcher
Returns the request dispatcher.- Specified by:
getRequestDispatcher
in interfacejakarta.servlet.ServletRequest
- Parameters:
path
- the path.- Returns:
- the request dispatcher
-
getScheme
Returns the scheme.- Specified by:
getScheme
in interfacejakarta.servlet.ServletRequest
- Returns:
- the scheme
-
getServerName
Returns the server name.- Specified by:
getServerName
in interfacejakarta.servlet.ServletRequest
- Returns:
- the server name
-
getServerPort
public int getServerPort()Returns the server port.- Specified by:
getServerPort
in interfacejakarta.servlet.ServletRequest
- Returns:
- the server port
-
getServletContext
public jakarta.servlet.ServletContext getServletContext()Returns the servlet context.- Specified by:
getServletContext
in interfacejakarta.servlet.ServletRequest
- Returns:
- the servlet context
-
isAsyncStarted
public boolean isAsyncStarted()Is async started.- Specified by:
isAsyncStarted
in interfacejakarta.servlet.ServletRequest
- Returns:
- true if async started, false otherwise.
-
isAsyncSupported
public boolean isAsyncSupported()Is async supported.- Specified by:
isAsyncSupported
in interfacejakarta.servlet.ServletRequest
- Returns:
- true if async is supported, false otherwise.
-
isSecure
public boolean isSecure()Is secure.- Specified by:
isSecure
in interfacejakarta.servlet.ServletRequest
- Returns:
- true if it is, false otherwise.
-
isWrapperFor
public boolean isWrapperFor(jakarta.servlet.ServletRequest wrapped) 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 interfacejakarta.servlet.ServletRequest
- Parameters:
name
- the name.
-
setAttribute
Set the attribute.- Specified by:
setAttribute
in interfacejakarta.servlet.ServletRequest
- Parameters:
name
- the name.object
- the object value.
-
setCharacterEncoding
Set the character encoding.- Specified by:
setCharacterEncoding
in interfacejakarta.servlet.ServletRequest
- Parameters:
characterEncoding
- the character encoding.- Throws:
UnsupportedEncodingException
- when trying to set an unsupported character encoding.
-
startAsync
Start async processing.- Specified by:
startAsync
in interfacejakarta.servlet.ServletRequest
- Throws:
IllegalStateException
- when not allowed.
-
startAsync
public jakarta.servlet.AsyncContext startAsync(jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse) throws IllegalStateException Start async processing.- Specified by:
startAsync
in interfacejakarta.servlet.ServletRequest
- Parameters:
servletRequest
- the servlet request.servletResponse
- the servlet response.- Throws:
IllegalStateException
-
authenticate
public boolean authenticate(jakarta.servlet.http.HttpServletResponse response) throws IOException, jakarta.servlet.ServletException Authenticate the request.- Specified by:
authenticate
in interfacejakarta.servlet.http.HttpServletRequest
- Parameters:
response
- the response.- Throws:
IOException
- when an I/O error occurs.jakarta.servlet.ServletException
- when a Servlet error occurs.
-
changeSessionId
Change the session id.- Specified by:
changeSessionId
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the new session id.
-
getAuthType
Returns the auth type.- Specified by:
getAuthType
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the auth type
-
getContextPath
Returns the context path.- Specified by:
getContextPath
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the context path
-
getCookies
public jakarta.servlet.http.Cookie[] getCookies()Get the cookies.- Specified by:
getCookies
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the cookies, or null if none.
-
getDateHeader
Get the date header.- Specified by:
getDateHeader
in interfacejakarta.servlet.http.HttpServletRequest
- Parameters:
name
- the name.- Returns:
- the date, or -1 if not found.
-
getHeader
Get the header.- Specified by:
getHeader
in interfacejakarta.servlet.http.HttpServletRequest
- Parameters:
name
- the name.- Returns:
- the value, or null if not found.
-
getHeaderNames
Returns the header names.- Specified by:
getHeaderNames
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the header names
-
getHeaders
Get the headers.- Specified by:
getHeaders
in interfacejakarta.servlet.http.HttpServletRequest
- Parameters:
name
- the name.- Returns:
- the values.
-
getIntHeader
Get the int header.- Specified by:
getIntHeader
in interfacejakarta.servlet.http.HttpServletRequest
- Parameters:
name
- the name.- Returns:
- the int, or -1 if not found.
-
getMethod
Returns the method.- Specified by:
getMethod
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the method
-
getPart
public jakarta.servlet.http.Part getPart(String name) throws IOException, jakarta.servlet.ServletException Get the part.- Specified by:
getPart
in interfacejakarta.servlet.http.HttpServletRequest
- Parameters:
name
- the name.- Throws:
IOException
- when an I/O error occurs.jakarta.servlet.ServletException
- when a Servlet error occurs.
-
getParts
public Collection<jakarta.servlet.http.Part> getParts() throws IOException, jakarta.servlet.ServletExceptionGet the parts.- Specified by:
getParts
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the parts.
- Throws:
IOException
- when an I/O error occurs.jakarta.servlet.ServletException
- when a Servlet error occurs.
-
getPathInfo
Returns the path info.- Specified by:
getPathInfo
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the path info
-
getPathTranslated
Returns the path translated.- Specified by:
getPathTranslated
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the path translated
-
getQueryString
Returns the query string.- Specified by:
getQueryString
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the query string
-
getRemoteUser
Returns the remote user.- Specified by:
getRemoteUser
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the remote user
-
getRequestURI
Returns the request URI.- Specified by:
getRequestURI
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the request URI
-
getRequestURL
Returns the request URL.- Specified by:
getRequestURL
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the request URL
-
getRequestedSessionId
Returns the requested session id.- Specified by:
getRequestedSessionId
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the requested session id
-
getServletPath
Returns the servlet path.- Specified by:
getServletPath
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the servlet path
-
getSession
public jakarta.servlet.http.HttpSession getSession()Returns the HTTP session.- Specified by:
getSession
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the HTTP session
-
getSession
public jakarta.servlet.http.HttpSession getSession(boolean create) Get the HTTP session.- Specified by:
getSession
in interfacejakarta.servlet.http.HttpServletRequest
- Parameters:
create
- the create flag.- Returns:
- the HTTP session, or null if not able to create.
-
getUserPrincipal
Returns the user principal.- Specified by:
getUserPrincipal
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- the user principal
-
getWrapped
protected abstract jakarta.servlet.http.HttpServletRequest getWrapped()Returns the wrapped request.- Returns:
- the wrapped request
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()Is the requested session id from a cookie.- Specified by:
isRequestedSessionIdFromCookie
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- true if it is, false otherwise.
-
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()Is the requested session id from a URL.- Specified by:
isRequestedSessionIdFromURL
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- true if it is, false otherwise.
-
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()Is the requested session id valid.- Specified by:
isRequestedSessionIdValid
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- true if it is, false otherwise.
-
isUserInRole
Is the user in the role.- Specified by:
isUserInRole
in interfacejakarta.servlet.http.HttpServletRequest
- Parameters:
role
- the role.- Returns:
- true if the user is, false otherwise.
-
login
Login.- Specified by:
login
in interfacejakarta.servlet.http.HttpServletRequest
- Parameters:
username
- the username.password
- the password.- Throws:
jakarta.servlet.ServletException
- when a Servlet error occurs.
-
logout
public void logout() throws jakarta.servlet.ServletExceptionLogout.- Specified by:
logout
in interfacejakarta.servlet.http.HttpServletRequest
- Throws:
jakarta.servlet.ServletException
- when a Servlet error occurs.
-
upgrade
public <T extends jakarta.servlet.http.HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, jakarta.servlet.ServletException Upgrade the request.- Specified by:
upgrade
in interfacejakarta.servlet.http.HttpServletRequest
- Type Parameters:
T
- the type of HTTP upgrade handler class.- Parameters:
handlerClass
- the handler class.- Returns:
- the HTTP upgrade handler.
- Throws:
IOException
- when an I/O error occurs.jakarta.servlet.ServletException
- when a Servlet error occurs.
-