Package org.springframework.http.server.reactive

# Class ServerHttpRequestDecorator

java.lang.Object
org.springframework.http.server.reactive.ServerHttpRequestDecorator

All Implemented Interfaces:
  `HttpMessage`, `HttpRequest`, `ReactiveHttpInputMessage`, `ServerHttpRequest`

public class ServerHttpRequestDecorator extends Object implements ServerHttpRequest
Wraps another `ServerHttpRequest` and delegates all methods to it. Subclasses can override specific methods selectively.

Since:
  5.0
Author:
  Rossen Stoyanchev

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.springframework.http.server.reactive.ServerHttpRequest

`ServerHttpRequest.Builder`

## Constructor Summary

Constructors
Constructor
Description
`ServerHttpRequestDecorator(ServerHttpRequest delegate)`

## Method Summary

Modifier and Type
Method
Description
`Map<String,Object>`
`getAttributes()`
Return a mutable map of request attributes for this request.
`reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer>`
`getBody()`
Return the body of the message as a `Publisher`.
`org.springframework.util.MultiValueMap<String,HttpCookie>`
`getCookies()`
Return a read-only map of cookies sent by the client.
`ServerHttpRequest`
`getDelegate()`
`HttpHeaders`
`getHeaders()`
Return the headers of this message.
`String`
`getId()`
Return an id that represents the underlying connection, if available, or the request for the purpose of correlating log messages.
`InetSocketAddress`
`getLocalAddress()`
Return the local address the request was accepted on, if available.
`HttpMethod`
`getMethod()`
Return the HTTP method of the request.
`static <T> T`
`getNativeRequest(ServerHttpRequest request)`
Return the native request of the underlying server API, if possible, also unwrapping `ServerHttpRequestDecorator` if necessary.
`RequestPath`
`getPath()`
Returns a structured representation of the full request path up to but not including the `query`.
`org.springframework.util.MultiValueMap<String,String>`
`getQueryParams()`
Return a read-only map with parsed and decoded query parameter values.
`InetSocketAddress`
`getRemoteAddress()`
Return the remote address where this request is connected to, if available.
`SslInfo`
`getSslInfo()`
Return the SSL session information if the request has been transmitted over a secure protocol including SSL certificates, if available.
`URI`
`getURI()`
Return the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).
`String`
`toString()`

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

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

### Methods inherited from interface org.springframework.http.server.reactive.ServerHttpRequest

`mutate`

## Constructor Details

### ServerHttpRequestDecorator

public ServerHttpRequestDecorator(ServerHttpRequest delegate)

## Method Details

### getDelegate

public ServerHttpRequest getDelegate()

### getId

public String getId()
Description copied from interface: `ServerHttpRequest`
Return an id that represents the underlying connection, if available, or the request for the purpose of correlating log messages.

Specified by:
  `getId` in interface `ServerHttpRequest`
See Also:
  - `ServerWebExchange.getLogPrefix()`

### getMethod

public HttpMethod getMethod()
Description copied from interface: `HttpRequest`
Return the HTTP method of the request.

Specified by:
  `getMethod` in interface `HttpRequest`
Returns:
  the HTTP method as an HttpMethod value
See Also:
  - `HttpMethod.valueOf(String)`

### getURI

public URI getURI()
Description copied from interface: `HttpRequest`
Return the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).

Specified by:
  `getURI` in interface `HttpRequest`
Returns:
  the URI of the request (never `null`)

### getAttributes

public Map<String,Object> getAttributes()
Description copied from interface: `HttpRequest`
Return a mutable map of request attributes for this request.

Specified by:
  `getAttributes` in interface `HttpRequest`

### getPath

public RequestPath getPath()
Description copied from interface: `ServerHttpRequest`
Returns a structured representation of the full request path up to but not including the `query`.

The returned path is subdivided into a `RequestPath.contextPath()` portion and the remaining `pathWithinApplication` portion. The latter can be passed into methods of `PathPattern` for path matching purposes.

Specified by:
  `getPath` in interface `ServerHttpRequest`

### getQueryParams

public org.springframework.util.MultiValueMap<String,String> getQueryParams()
Description copied from interface: `ServerHttpRequest`
Return a read-only map with parsed and decoded query parameter values.

Specified by:
  `getQueryParams` in interface `ServerHttpRequest`

### getHeaders

public HttpHeaders getHeaders()
Description copied from interface: `HttpMessage`
Return the headers of this message.

Specified by:
  `getHeaders` in interface `HttpMessage`
Returns:
  a corresponding HttpHeaders object (never `null`)

### getCookies

public org.springframework.util.MultiValueMap<String,HttpCookie> getCookies()
Description copied from interface: `ServerHttpRequest`
Return a read-only map of cookies sent by the client.

Specified by:
  `getCookies` in interface `ServerHttpRequest`

### getLocalAddress

@Nullable public InetSocketAddress getLocalAddress()
Description copied from interface: `ServerHttpRequest`
Return the local address the request was accepted on, if available.

Specified by:
  `getLocalAddress` in interface `ServerHttpRequest`

### getRemoteAddress

@Nullable public InetSocketAddress getRemoteAddress()
Description copied from interface: `ServerHttpRequest`
Return the remote address where this request is connected to, if available.

Specified by:
  `getRemoteAddress` in interface `ServerHttpRequest`

### getSslInfo

@Nullable public SslInfo getSslInfo()
Description copied from interface: `ServerHttpRequest`
Return the SSL session information if the request has been transmitted over a secure protocol including SSL certificates, if available.

Specified by:
  `getSslInfo` in interface `ServerHttpRequest`
Returns:
  the session information, or `null` if none available

### getBody

public reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer> getBody()
Description copied from interface: `ReactiveHttpInputMessage`
Return the body of the message as a `Publisher`.

Specified by:
  `getBody` in interface `ReactiveHttpInputMessage`
Returns:
  the body content publisher

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### getNativeRequest

public static <T> T getNativeRequest(ServerHttpRequest request)
Return the native request of the underlying server API, if possible, also unwrapping `ServerHttpRequestDecorator` if necessary.

Type Parameters:
  `T` - the expected native request type
Parameters:
  `request` - the request to check
Throws:
  `IllegalArgumentException` - if the native request can't be obtained
Since:
  5.3.3