Class HttpRequestWrapper

  • All Implemented Interfaces:
    jakarta.servlet.ServletRequest, HttpRequest, Request

    public class HttpRequestWrapper
    extends Object
    implements HttpRequest, jakarta.servlet.ServletRequest
    • Constructor Detail

      • HttpRequestWrapper

        public HttpRequestWrapper​(HttpRequest request,
                                  jakarta.servlet.http.HttpServletRequest servletRequest)
    • Method Detail

      • addCookie

        public void addCookie​(jakarta.servlet.http.Cookie cookie)
        Description copied from interface: HttpRequest
        Add a Cookie to the set of Cookies associated with this Request.
        Specified by:
        addCookie in interface HttpRequest
        Parameters:
        cookie - The new cookie
      • addHeader

        public void addHeader​(String name,
                              String value)
        Description copied from interface: HttpRequest
        Add a Header to the set of Headers associated with this Request.
        Specified by:
        addHeader in interface HttpRequest
        Parameters:
        name - The new header name
        value - The new header value
      • addLocale

        public void addLocale​(Locale locale)
        Description copied from interface: HttpRequest
        Add a Locale to the set of preferred Locales for this Request. The first added Locale will be the first one returned by getLocales().
        Specified by:
        addLocale in interface HttpRequest
        Parameters:
        locale - The new preferred Locale
      • addParameter

        public void addParameter​(String name,
                                 String[] values)
        Description copied from interface: HttpRequest
        Add a parameter name and corresponding set of values to this Request. (This is used when restoring the original request on a form based login).
        Specified by:
        addParameter in interface HttpRequest
        Parameters:
        name - Name of this request parameter
        values - Corresponding values for this request parameter
      • clearCookies

        public void clearCookies()
        Description copied from interface: HttpRequest
        Clear the collection of Cookies associated with this Request.
        Specified by:
        clearCookies in interface HttpRequest
      • clearHeaders

        public void clearHeaders()
        Description copied from interface: HttpRequest
        Clear the collection of Headers associated with this Request.
        Specified by:
        clearHeaders in interface HttpRequest
      • clearLocales

        public void clearLocales()
        Description copied from interface: HttpRequest
        Clear the collection of Locales associated with this Request.
        Specified by:
        clearLocales in interface HttpRequest
      • clearParameters

        public void clearParameters()
        Description copied from interface: HttpRequest
        Clear the collection of parameters associated with this Request.
        Specified by:
        clearParameters in interface HttpRequest
      • replayPayload

        public void replayPayload​(byte[] payloadByteArray)
        Specified by:
        replayPayload in interface HttpRequest
      • setAuthType

        public void setAuthType​(String type)
        Description copied from interface: HttpRequest
        Set the authentication type used for this request, if any; otherwise set the type to null. Typical values are "BASIC", "DIGEST", or "SSL".
        Specified by:
        setAuthType in interface HttpRequest
        Parameters:
        type - The authentication type used
      • setMethod

        public void setMethod​(String method)
        Description copied from interface: HttpRequest
        Set the HTTP request method used for this Request.
        Specified by:
        setMethod in interface HttpRequest
        Parameters:
        method - The request method
      • setQueryString

        public void setQueryString​(String query)
        Description copied from interface: HttpRequest
        Set the query string for this Request. This will normally be called by the HTTP Connector, when it parses the request headers.
        Specified by:
        setQueryString in interface HttpRequest
        Parameters:
        query - The query string
      • getSessionInternal

        public Session getSessionInternal​(boolean create)
        Description copied from interface: Request
        Gets the session associated with this Request, creating one if necessary and requested.
        Specified by:
        getSessionInternal in interface Request
        Parameters:
        create - true if a new session is to be created if one does not already exist, false otherwise
      • changeSessionId

        public String changeSessionId()
        Description copied from interface: Request
        Change the ID of the session that this request is associated with. There are several things that may trigger an ID change. These include moving between nodes in a cluster and session fixation prevention during the authentication process.
        Specified by:
        changeSessionId in interface Request
      • setPathInfo

        public void setPathInfo​(String path)
        Description copied from interface: HttpRequest
        Set the path information for this Request. This will normally be called when the associated Context is mapping the Request to a particular Wrapper.
        Specified by:
        setPathInfo in interface HttpRequest
        Parameters:
        path - The path information
      • getRequestPathMB

        public org.glassfish.grizzly.http.util.DataChunk getRequestPathMB()
        Description copied from interface: HttpRequest
        Get the request path.
        Specified by:
        getRequestPathMB in interface HttpRequest
        Returns:
        the request path
      • setRequestedSessionCookie

        public void setRequestedSessionCookie​(boolean flag)
        Description copied from interface: HttpRequest
        Set a flag indicating whether or not the requested session ID for this request came in through a cookie. This is normally called by the HTTP Connector, when it parses the request headers.
        Specified by:
        setRequestedSessionCookie in interface HttpRequest
        Parameters:
        flag - The new flag
      • setRequestedSessionCookiePath

        public void setRequestedSessionCookiePath​(String cookiePath)
        Description copied from interface: Request
        Sets the requested session cookie path, see IT 7426
        Specified by:
        setRequestedSessionCookiePath in interface Request
      • setRequestedSessionId

        public void setRequestedSessionId​(String id)
        Description copied from interface: HttpRequest
        Set the requested session ID for this request. This is normally called by the HTTP Connector, when it parses the request headers.
        Specified by:
        setRequestedSessionId in interface HttpRequest
        Parameters:
        id - The new session id
      • setRequestedSessionURL

        public void setRequestedSessionURL​(boolean flag)
        Description copied from interface: HttpRequest
        Set a flag indicating whether or not the requested session ID for this request came in through a URL. This is normally called by the HTTP Connector, when it parses the request headers.
        Specified by:
        setRequestedSessionURL in interface HttpRequest
        Parameters:
        flag - The new flag
      • setRequestURI

        public void setRequestURI​(String uri)
        Description copied from interface: HttpRequest
        Set the unparsed request URI for this Request. This will normally be called by the HTTP Connector, when it parses the request headers.
        Specified by:
        setRequestURI in interface HttpRequest
        Parameters:
        uri - The request URI
      • setServletPath

        public void setServletPath​(String path)
        Description copied from interface: HttpRequest
        Set the servlet path for this Request. This will normally be called when the associated Context is mapping the Request to a particular Wrapper.
        Specified by:
        setServletPath in interface HttpRequest
        Parameters:
        path - The servlet path
      • setUserPrincipal

        public void setUserPrincipal​(Principal principal)
        Description copied from interface: HttpRequest
        Set the Principal who has been authenticated for this Request. This value is also used to calculate the value to be returned by the getRemoteUser() method.
        Specified by:
        setUserPrincipal in interface HttpRequest
        Parameters:
        principal - The user Principal
      • getAuthorization

        public String getAuthorization()
        Description copied from interface: Request
        Return the authorization credentials sent with this request.
        Specified by:
        getAuthorization in interface Request
      • getConnector

        public Connector getConnector()
        Description copied from interface: Request
        Return the Connector through which this Request was received.
        Specified by:
        getConnector in interface Request
      • setConnector

        public void setConnector​(Connector connector)
        Description copied from interface: Request
        Set the Connector through which this Request was received.
        Specified by:
        setConnector in interface Request
        Parameters:
        connector - The new connector
      • getContext

        public Context getContext()
        Description copied from interface: Request
        Return the Context within which this Request is being processed.
        Specified by:
        getContext in interface Request
      • setContext

        public void setContext​(Context context)
        Description copied from interface: Request
        Set the Context within which this Request is being processed. This must be called as soon as the appropriate Context is identified, because it identifies the value to be returned by getContextPath(), and thus enables parsing of the request URI.
        Specified by:
        setContext in interface Request
        Parameters:
        context - The newly associated Context
      • getFilterChain

        public jakarta.servlet.FilterChain getFilterChain()
        Description copied from interface: Request
        Get filter chain associated with the request.
        Specified by:
        getFilterChain in interface Request
      • setFilterChain

        public void setFilterChain​(jakarta.servlet.FilterChain filterChain)
        Description copied from interface: Request
        Set filter chain associated with the request.
        Specified by:
        setFilterChain in interface Request
        Parameters:
        filterChain - new filter chain
      • getHost

        public Host getHost()
        Description copied from interface: Request
        Return the Host within which this Request is being processed.
        Specified by:
        getHost in interface Request
      • setHost

        public void setHost​(Host host)
        Description copied from interface: Request
        Set the Host within which this Request is being processed. This must be called as soon as the appropriate Host is identified, and before the Request is passed to a context.
        Specified by:
        setHost in interface Request
        Parameters:
        host - The newly associated Host
      • getInfo

        public String getInfo()
        Description copied from interface: Request
        Return descriptive information about this Request implementation and the corresponding version number, in the format <description>/<version>.
        Specified by:
        getInfo in interface Request
      • getRequest

        public jakarta.servlet.ServletRequest getRequest()
        Description copied from interface: Request
        Return the ServletRequest for which this object is the facade.
        Specified by:
        getRequest in interface Request
      • getRequest

        public jakarta.servlet.ServletRequest getRequest​(boolean maskDefaultContextMapping)
        Description copied from interface: Request
        Return the ServletRequest for which this object is the facade.
        Specified by:
        getRequest in interface Request
        Parameters:
        maskDefaultContextMapping - true if the fact that a request received at the root context was mapped to a default-web-module will be masked, false otherwise
      • getResponse

        public Response getResponse()
        Description copied from interface: Request
        Return the Response with which this Request is associated.
        Specified by:
        getResponse in interface Request
      • setResponse

        public void setResponse​(Response response)
        Description copied from interface: Request
        Set the Response with which this Request is associated.
        Specified by:
        setResponse in interface Request
        Parameters:
        response - The new associated response
      • getSocket

        public Socket getSocket()
        Description copied from interface: Request
        Return the Socket (if any) through which this Request was received. This should only be used to access underlying state information about this Socket, such as the SSLSession associated with an SSLSocket.
        Specified by:
        getSocket in interface Request
      • setSocket

        public void setSocket​(Socket socket)
        Description copied from interface: Request
        Set the Socket (if any) through which this Request was received.
        Specified by:
        setSocket in interface Request
        Parameters:
        socket - The socket through which this request was received
      • getStream

        public InputStream getStream()
        Description copied from interface: Request
        Return the input stream associated with this Request.
        Specified by:
        getStream in interface Request
      • setStream

        public void setStream​(InputStream stream)
        Description copied from interface: Request
        Set the input stream associated with this Request.
        Specified by:
        setStream in interface Request
        Parameters:
        stream - The new input stream
      • getWrapper

        public Wrapper getWrapper()
        Description copied from interface: Request
        Return the Wrapper within which this Request is being processed.
        Specified by:
        getWrapper in interface Request
      • setWrapper

        public void setWrapper​(Wrapper wrapper)
        Description copied from interface: Request
        Set the Wrapper within which this Request is being processed. This must be called as soon as the appropriate Wrapper is identified, and before the Request is ultimately passed to an application servlet.
        Specified by:
        setWrapper in interface Request
        Parameters:
        wrapper - The newly associated Wrapper
      • createInputStream

        public jakarta.servlet.ServletInputStream createInputStream()
                                                             throws IOException
        Description copied from interface: Request
        Create and return a ServletInputStream to read the content associated with this Request.
        Specified by:
        createInputStream in interface Request
        Throws:
        IOException - if an input/output error occurs
      • finishRequest

        public void finishRequest()
                           throws IOException
        Description copied from interface: Request
        Perform whatever actions are required to flush and close the input stream or reader, in a single operation.
        Specified by:
        finishRequest in interface Request
        Throws:
        IOException - if an input/output error occurs
      • getNote

        public Object getNote​(String name)
        Description copied from interface: Request
        Return the object bound with the specified name to the internal notes for this request, or null if no such binding exists.
        Specified by:
        getNote in interface Request
        Parameters:
        name - Name of the note to be returned
      • getNoteNames

        public Iterator getNoteNames()
        Description copied from interface: Request
        Return an Iterator containing the String names of all notes bindings that exist for this request.
        Specified by:
        getNoteNames in interface Request
      • recycle

        public void recycle()
        Description copied from interface: Request
        Release all object references, and initialize instance variables, in preparation for reuse of this object.
        Specified by:
        recycle in interface Request
      • removeNote

        public void removeNote​(String name)
        Description copied from interface: Request
        Remove any object bound to the specified name in the internal notes for this request.
        Specified by:
        removeNote in interface Request
        Parameters:
        name - Name of the note to be removed
      • setContentLength

        public void setContentLength​(int length)
        Description copied from interface: Request
        Set the content length associated with this Request.
        Specified by:
        setContentLength in interface Request
        Parameters:
        length - The new content length
      • setContentType

        public void setContentType​(String type)
        Description copied from interface: Request
        Set the content type (and optionally the character encoding) associated with this Request. For example, text/html; charset=ISO-8859-4.
        Specified by:
        setContentType in interface Request
        Parameters:
        type - The new content type
      • setNote

        public void setNote​(String name,
                            Object value)
        Description copied from interface: Request
        Bind an object to a specified name in the internal notes associated with this request, replacing any existing binding for this name.
        Specified by:
        setNote in interface Request
        Parameters:
        name - Name to which the object should be bound
        value - Object to be bound to the specified name
      • setProtocol

        public void setProtocol​(String protocol)
        Description copied from interface: Request
        Set the protocol name and version associated with this Request.
        Specified by:
        setProtocol in interface Request
        Parameters:
        protocol - Protocol name and version
      • setRemoteAddr

        public void setRemoteAddr​(String remote)
        Description copied from interface: Request
        Set the remote IP address associated with this Request. NOTE: This value will be used to resolve the value for getRemoteHost() if that method is called.
        Specified by:
        setRemoteAddr in interface Request
        Parameters:
        remote - The remote IP address
      • setSecure

        public void setSecure​(boolean secure)
        Description copied from interface: Request
        Set the value to be returned by isSecure() for this Request.
        Specified by:
        setSecure in interface Request
        Parameters:
        secure - The new isSecure value
      • setServerName

        public void setServerName​(String name)
        Description copied from interface: Request
        Set the name of the server (virtual host) to process this request.
        Specified by:
        setServerName in interface Request
        Parameters:
        name - The server name
      • setServerPort

        public void setServerPort​(int port)
        Description copied from interface: Request
        Set the port number of the server to process this request.
        Specified by:
        setServerPort in interface Request
        Parameters:
        port - The server port
      • setCheckRestrictedResources

        public void setCheckRestrictedResources​(boolean check)
        Description copied from interface: Request
        Set whether or not access to resources under WEB-INF or META-INF needs to be checked.
        Specified by:
        setCheckRestrictedResources in interface Request
      • getCheckRestrictedResources

        public boolean getCheckRestrictedResources()
        Description copied from interface: Request
        Return whether or not access to resources under WEB-INF or META-INF needs to be checked.
        Specified by:
        getCheckRestrictedResources in interface Request
      • getJrouteId

        public String getJrouteId()
        Description copied from interface: Request
        Gets the jroute id of this request, which may have been sent as a separate JROUTE cookie or appended to the session identifier encoded in the URI (if cookies have been disabled).
        Specified by:
        getJrouteId in interface Request
        Returns:
        The jroute id of this request, or null if this request does not carry any jroute id
      • generateSessionId

        public String generateSessionId()
        Generate and return a new session ID. This hook allows connectors to provide their own scalable session ID generators.
        Specified by:
        generateSessionId in interface Request
      • disableAsyncSupport

        public void disableAsyncSupport()
        Disables async support on this request.
        Specified by:
        disableAsyncSupport in interface Request
      • getAttribute

        public Object getAttribute​(String name)
        Specified by:
        getAttribute in interface jakarta.servlet.ServletRequest
      • getAttributeNames

        public Enumeration<String> getAttributeNames()
        Specified by:
        getAttributeNames in interface jakarta.servlet.ServletRequest
      • getCharacterEncoding

        public String getCharacterEncoding()
        Specified by:
        getCharacterEncoding in interface jakarta.servlet.ServletRequest
      • getContentLength

        public int getContentLength()
        Specified by:
        getContentLength in interface jakarta.servlet.ServletRequest
      • getContentType

        public String getContentType()
        Specified by:
        getContentType in interface jakarta.servlet.ServletRequest
      • getInputStream

        public jakarta.servlet.ServletInputStream getInputStream()
                                                          throws IOException
        Specified by:
        getInputStream in interface jakarta.servlet.ServletRequest
        Throws:
        IOException
      • getParameter

        public String getParameter​(String name)
        Specified by:
        getParameter in interface jakarta.servlet.ServletRequest
      • getParameterNames

        public Enumeration<String> getParameterNames()
        Specified by:
        getParameterNames in interface jakarta.servlet.ServletRequest
      • getParameterValues

        public String[] getParameterValues​(String name)
        Specified by:
        getParameterValues in interface jakarta.servlet.ServletRequest
      • getParameterMap

        public Map<String,​String[]> getParameterMap()
        Specified by:
        getParameterMap in interface jakarta.servlet.ServletRequest
      • getProtocol

        public String getProtocol()
        Specified by:
        getProtocol in interface jakarta.servlet.ServletRequest
      • getScheme

        public String getScheme()
        Specified by:
        getScheme in interface jakarta.servlet.ServletRequest
      • getServerName

        public String getServerName()
        Specified by:
        getServerName in interface jakarta.servlet.ServletRequest
      • getServerPort

        public int getServerPort()
        Specified by:
        getServerPort in interface jakarta.servlet.ServletRequest
      • getRemoteAddr

        public String getRemoteAddr()
        Specified by:
        getRemoteAddr in interface jakarta.servlet.ServletRequest
      • getRemoteHost

        public String getRemoteHost()
        Specified by:
        getRemoteHost in interface jakarta.servlet.ServletRequest
      • setAttribute

        public void setAttribute​(String name,
                                 Object o)
        Specified by:
        setAttribute in interface jakarta.servlet.ServletRequest
      • removeAttribute

        public void removeAttribute​(String name)
        Specified by:
        removeAttribute in interface jakarta.servlet.ServletRequest
      • getLocale

        public Locale getLocale()
        Specified by:
        getLocale in interface jakarta.servlet.ServletRequest
      • getLocales

        public Enumeration<Locale> getLocales()
        Specified by:
        getLocales in interface jakarta.servlet.ServletRequest
      • isSecure

        public boolean isSecure()
        Specified by:
        isSecure in interface jakarta.servlet.ServletRequest
      • getRequestDispatcher

        public jakarta.servlet.RequestDispatcher getRequestDispatcher​(String path)
        Specified by:
        getRequestDispatcher in interface jakarta.servlet.ServletRequest
      • getRemotePort

        public int getRemotePort()
        Specified by:
        getRemotePort in interface jakarta.servlet.ServletRequest
      • getLocalName

        public String getLocalName()
        Specified by:
        getLocalName in interface jakarta.servlet.ServletRequest
      • getLocalAddr

        public String getLocalAddr()
        Specified by:
        getLocalAddr in interface jakarta.servlet.ServletRequest
      • getLocalPort

        public int getLocalPort()
        Specified by:
        getLocalPort in interface jakarta.servlet.ServletRequest
      • getServletContext

        public jakarta.servlet.ServletContext getServletContext()
        Specified by:
        getServletContext in interface jakarta.servlet.ServletRequest
      • startAsync

        public jakarta.servlet.AsyncContext startAsync​(jakarta.servlet.ServletRequest sRequest,
                                                       jakarta.servlet.ServletResponse sResponse)
                                                throws IllegalStateException
        Specified by:
        startAsync in interface jakarta.servlet.ServletRequest
        Throws:
        IllegalStateException
      • isAsyncStarted

        public boolean isAsyncStarted()
        Specified by:
        isAsyncStarted in interface jakarta.servlet.ServletRequest
      • isAsyncSupported

        public boolean isAsyncSupported()
        Specified by:
        isAsyncSupported in interface jakarta.servlet.ServletRequest
      • getAsyncContext

        public jakarta.servlet.AsyncContext getAsyncContext()
        Specified by:
        getAsyncContext in interface jakarta.servlet.ServletRequest
      • getDispatcherType

        public jakarta.servlet.DispatcherType getDispatcherType()
        Specified by:
        getDispatcherType in interface jakarta.servlet.ServletRequest
      • getContentLengthLong

        public long getContentLengthLong()
        Specified by:
        getContentLengthLong in interface jakarta.servlet.ServletRequest
      • getRequestId

        public String getRequestId()
        Specified by:
        getRequestId in interface jakarta.servlet.ServletRequest
      • getProtocolRequestId

        public String getProtocolRequestId()
        Specified by:
        getProtocolRequestId in interface jakarta.servlet.ServletRequest
      • getServletConnection

        public jakarta.servlet.ServletConnection getServletConnection()
        Specified by:
        getServletConnection in interface jakarta.servlet.ServletRequest