Class SavedRequest

  • All Implemented Interfaces:
    java.io.Serializable

    public final class SavedRequest
    extends java.lang.Object
    implements java.io.Serializable
    Object that saves the critical information from a request so that form-based authentication can reproduce it once the user has been authenticated.

    IMPLEMENTATION NOTE - It is assumed that this object is accessed only from the context of a single thread, so no synchronization around internal collection classes is performed.

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      SavedRequest()
      Default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addCookie​(Cookie cookie)
      Adds a cookie to this saved request.
      void addHeader​(java.lang.String name, java.lang.String value)
      Adds a header value to this saved request.
      void addLocale​(java.util.Locale locale)
      Adds a locale to this saved request.
      ByteChunk getBody()
      Returns the body of the saved request.
      java.lang.String getContentType()
      Returns the content type of the saved request.
      java.util.Iterator<Cookie> getCookies()
      Returns an iterator over the cookies saved for this request.
      java.lang.String getDecodedRequestURI()
      Returns the decoded request URI of the saved request, with path parameters excluded.
      java.util.Iterator<java.lang.String> getHeaderNames()
      Returns an iterator over the names of all headers saved for this request.
      java.util.Iterator<java.lang.String> getHeaderValues​(java.lang.String name)
      Returns an iterator over the values for the specified header.
      java.util.Iterator<java.util.Locale> getLocales()
      Returns an iterator over the locales saved for this request.
      java.lang.String getMethod()
      Returns the HTTP method of the saved request.
      int getOriginalMaxInactiveInterval()
      Deprecated.
      This method will be removed in Tomcat 12.0.x onwards.
      java.lang.Integer getOriginalMaxInactiveIntervalOptional()
      Returns the original max inactive interval for the session.
      java.lang.String getQueryString()
      Returns the query string of the saved request.
      java.lang.String getRequestURI()
      Returns the request URI of the saved request.
      void setBody​(ByteChunk body)
      Sets the body of the saved request.
      void setContentType​(java.lang.String contentType)
      Sets the content type of the saved request.
      void setDecodedRequestURI​(java.lang.String decodedRequestURI)
      Sets the decoded request URI of the saved request.
      void setMethod​(java.lang.String method)
      Sets the HTTP method of the saved request.
      void setOriginalMaxInactiveInterval​(int originalMaxInactiveInterval)
      Sets the original max inactive interval for the session.
      void setQueryString​(java.lang.String queryString)
      Sets the query string of the saved request.
      void setRequestURI​(java.lang.String requestURI)
      Sets the request URI of the saved request.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SavedRequest

        public SavedRequest()
        Default constructor.
    • Method Detail

      • addCookie

        public void addCookie​(Cookie cookie)
        Adds a cookie to this saved request.
        Parameters:
        cookie - the cookie to add
      • getCookies

        public java.util.Iterator<Cookie> getCookies()
        Returns an iterator over the cookies saved for this request.
        Returns:
        iterator over the saved cookies
      • addHeader

        public void addHeader​(java.lang.String name,
                              java.lang.String value)
        Adds a header value to this saved request.
        Parameters:
        name - the header name
        value - the header value
      • getHeaderNames

        public java.util.Iterator<java.lang.String> getHeaderNames()
        Returns an iterator over the names of all headers saved for this request.
        Returns:
        iterator over the header names
      • getHeaderValues

        public java.util.Iterator<java.lang.String> getHeaderValues​(java.lang.String name)
        Returns an iterator over the values for the specified header.
        Parameters:
        name - the header name
        Returns:
        iterator over the header values, or an empty iterator if the header is not present
      • addLocale

        public void addLocale​(java.util.Locale locale)
        Adds a locale to this saved request.
        Parameters:
        locale - the locale to add
      • getLocales

        public java.util.Iterator<java.util.Locale> getLocales()
        Returns an iterator over the locales saved for this request.
        Returns:
        iterator over the saved locales
      • getMethod

        public java.lang.String getMethod()
        Returns the HTTP method of the saved request.
        Returns:
        the request method, or null if not set
      • setMethod

        public void setMethod​(java.lang.String method)
        Sets the HTTP method of the saved request.
        Parameters:
        method - the request method
      • getQueryString

        public java.lang.String getQueryString()
        Returns the query string of the saved request.
        Returns:
        the query string, or null if not set
      • setQueryString

        public void setQueryString​(java.lang.String queryString)
        Sets the query string of the saved request.
        Parameters:
        queryString - the query string
      • getRequestURI

        public java.lang.String getRequestURI()
        Returns the request URI of the saved request.
        Returns:
        the request URI, or null if not set
      • setRequestURI

        public void setRequestURI​(java.lang.String requestURI)
        Sets the request URI of the saved request.
        Parameters:
        requestURI - the request URI
      • getDecodedRequestURI

        public java.lang.String getDecodedRequestURI()
        Returns the decoded request URI of the saved request, with path parameters excluded.
        Returns:
        the decoded request URI, or null if not set
      • setDecodedRequestURI

        public void setDecodedRequestURI​(java.lang.String decodedRequestURI)
        Sets the decoded request URI of the saved request.
        Parameters:
        decodedRequestURI - the decoded request URI
      • getBody

        public ByteChunk getBody()
        Returns the body of the saved request.
        Returns:
        the request body as a ByteChunk, or null if not set
      • setBody

        public void setBody​(ByteChunk body)
        Sets the body of the saved request.
        Parameters:
        body - the request body as a ByteChunk
      • getContentType

        public java.lang.String getContentType()
        Returns the content type of the saved request.
        Returns:
        the content type, or null if not set
      • setContentType

        public void setContentType​(java.lang.String contentType)
        Sets the content type of the saved request.
        Parameters:
        contentType - the content type
      • getOriginalMaxInactiveIntervalOptional

        public java.lang.Integer getOriginalMaxInactiveIntervalOptional()
        Returns the original max inactive interval for the session.
        Returns:
        the original max inactive interval, or null if not set
      • getOriginalMaxInactiveInterval

        @Deprecated
        public int getOriginalMaxInactiveInterval()
        Deprecated.
        This method will be removed in Tomcat 12.0.x onwards. Use getOriginalMaxInactiveIntervalOptional()
        Obtain the original session maxInactiveInterval.
        Returns:
        the original session maxInactiveInterval
      • setOriginalMaxInactiveInterval

        public void setOriginalMaxInactiveInterval​(int originalMaxInactiveInterval)
        Sets the original max inactive interval for the session.
        Parameters:
        originalMaxInactiveInterval - the max inactive interval in seconds