Package org.springframework.security.web.savedrequest

# Class DefaultSavedRequest

java.lang.Object
org.springframework.security.web.savedrequest.DefaultSavedRequest

All Implemented Interfaces:
  `Serializable`, `SavedRequest`

public class DefaultSavedRequest extends Object implements SavedRequest
Represents central information from a `HttpServletRequest`.

This class is used by `AbstractAuthenticationProcessingFilter` and `SavedRequestAwareWrapper` to reproduce the request after successful authentication. An instance of this class is stored at the time of an authentication exception by `ExceptionTranslationFilter`.

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.

This class is based on code in Apache Tomcat.

See Also:
  - Serialized Form

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`DefaultSavedRequest.Builder`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected static final org.apache.commons.logging.Log`
`logger`

## Constructor Summary

Constructors
Constructor
Description
`DefaultSavedRequest(jakarta.servlet.http.HttpServletRequest request, PortResolver portResolver)`
`DefaultSavedRequest(jakarta.servlet.http.HttpServletRequest request, PortResolver portResolver, String matchingRequestParameterName)`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`doesRequestMatch(jakarta.servlet.http.HttpServletRequest request, PortResolver portResolver)`
Determines if the current request matches the `DefaultSavedRequest`.
`String`
`getContextPath()`
`List<jakarta.servlet.http.Cookie>`
`getCookies()`
`Collection<String>`
`getHeaderNames()`
`List<String>`
`getHeaderValues(String name)`
`List<Locale>`
`getLocales()`
`String`
`getMethod()`
`Map<String,String[]>`
`getParameterMap()`
`Collection<String>`
`getParameterNames()`
`String[]`
`getParameterValues(String name)`
`String`
`getPathInfo()`
`String`
`getQueryString()`
`String`
`getRedirectUrl()`
Indicates the URL that the user agent used for this request.
`String`
`getRequestURI()`
`String`
`getRequestURL()`
`String`
`getScheme()`
`String`
`getServerName()`
`int`
`getServerPort()`
`String`
`getServletPath()`
`String`
`toString()`

### Methods inherited from class java.lang.Object

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

## Field Details

### logger

protected static final org.apache.commons.logging.Log logger

## Constructor Details

### DefaultSavedRequest

public DefaultSavedRequest(jakarta.servlet.http.HttpServletRequest request, PortResolver portResolver)

### DefaultSavedRequest

public DefaultSavedRequest(jakarta.servlet.http.HttpServletRequest request, PortResolver portResolver, String matchingRequestParameterName)

## Method Details

### doesRequestMatch

public boolean doesRequestMatch(jakarta.servlet.http.HttpServletRequest request, PortResolver portResolver)
Determines if the current request matches the `DefaultSavedRequest`.

All URL arguments are considered but not cookies, locales, headers or parameters.

Parameters:
  `request` - the actual request to be matched against this one
  `portResolver` - used to obtain the server port of the request
Returns:
  true if the request is deemed to match this one.

### getContextPath

public String getContextPath()

### getCookies

public List<jakarta.servlet.http.Cookie> getCookies()

Specified by:
  `getCookies` in interface `SavedRequest`

### getRedirectUrl

public String getRedirectUrl()
Indicates the URL that the user agent used for this request.

Specified by:
  `getRedirectUrl` in interface `SavedRequest`
Returns:
  the full URL of this request

### getHeaderNames

public Collection<String> getHeaderNames()

Specified by:
  `getHeaderNames` in interface `SavedRequest`

### getHeaderValues

public List<String> getHeaderValues(String name)

Specified by:
  `getHeaderValues` in interface `SavedRequest`

### getLocales

public List<Locale> getLocales()

Specified by:
  `getLocales` in interface `SavedRequest`

### getMethod

public String getMethod()

Specified by:
  `getMethod` in interface `SavedRequest`

### getParameterMap

public Map<String,String[]> getParameterMap()

Specified by:
  `getParameterMap` in interface `SavedRequest`

### getParameterNames

public Collection<String> getParameterNames()

### getParameterValues

public String[] getParameterValues(String name)

Specified by:
  `getParameterValues` in interface `SavedRequest`

### getPathInfo

public String getPathInfo()

### getQueryString

public String getQueryString()

### getRequestURI

public String getRequestURI()

### getRequestURL

public String getRequestURL()

### getScheme

public String getScheme()

### getServerName

public String getServerName()

### getServerPort

public int getServerPort()

### getServletPath

public String getServletPath()

### toString

public String toString()

Overrides:
  `toString` in class `Object`