# Class SavedRequest

java.lang.Object
org.apache.catalina.authenticator.SavedRequest

All Implemented Interfaces:
  `Serializable`

public final class SavedRequest extends Object implements 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

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

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SavedRequest

public SavedRequest()
Default constructor.

## Method Details

### addCookie

public void addCookie(Cookie cookie)
Adds a cookie to this saved request.

Parameters:
  `cookie` - the cookie to add

### getCookies

public Iterator<Cookie> getCookies()
Returns an iterator over the cookies saved for this request.

Returns:
  iterator over the saved cookies

### addHeader

public void addHeader(String name, String value)
Adds a header value to this saved request.

Parameters:
  `name` - the header name
  `value` - the header value

### getHeaderNames

public Iterator<String> getHeaderNames()
Returns an iterator over the names of all headers saved for this request.

Returns:
  iterator over the header names

### getHeaderValues

public Iterator<String> getHeaderValues(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(Locale locale)
Adds a locale to this saved request.

Parameters:
  `locale` - the locale to add

### getLocales

public Iterator<Locale> getLocales()
Returns an iterator over the locales saved for this request.

Returns:
  iterator over the saved locales

### getMethod

public String getMethod()
Returns the HTTP method of the saved request.

Returns:
  the request method, or `null` if not set

### setMethod

public void setMethod(String method)
Sets the HTTP method of the saved request.

Parameters:
  `method` - the request method

### getQueryString

public String getQueryString()
Returns the query string of the saved request.

Returns:
  the query string, or `null` if not set

### setQueryString

public void setQueryString(String queryString)
Sets the query string of the saved request.

Parameters:
  `queryString` - the query string

### getRequestURI

public String getRequestURI()
Returns the request URI of the saved request.

Returns:
  the request URI, or `null` if not set

### setRequestURI

public void setRequestURI(String requestURI)
Sets the request URI of the saved request.

Parameters:
  `requestURI` - the request URI

### getDecodedRequestURI

public 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(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 String getContentType()
Returns the content type of the saved request.

Returns:
  the content type, or `null` if not set

### setContentType

public void setContentType(String contentType)
Sets the content type of the saved request.

Parameters:
  `contentType` - the content type

### getOriginalMaxInactiveIntervalOptional

public 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