Top Description Inners Fields Constructors Methods
org.springframework.http.server.reactive

pack-priv Class DefaultServerHttpRequestBuilder

extends Object
implements Builder
Class Inheritance
All Implemented Interfaces
org.springframework.http.server.reactive.ServerHttpRequest.Builder
Imports
java.net.InetSocketAddress, .URI, .URISyntaxException, java.util.Arrays, java.util.function.Consumer, reactor.core.publisher.Flux, org.springframework.core.io.buffer.DataBuffer, org.springframework.http.HttpCookie, .HttpHeaders, .HttpMethod, org.springframework.lang.Nullable, org.springframework.util.Assert, .MultiValueMap, .StringUtils

Package-private default implementation of ServerHttpRequest.Builder.
Authors
Rossen Stoyanchev, Sebastien Deleuze, Brian Clozel
Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final Flux<DataBuffer>
private String
private final HttpHeaders
private HttpMethod
private final ServerHttpRequest
private InetSocketAddress
private SslInfo
private URI
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ServerHttpRequest
build()

Implements org.springframework.http.server.reactive.ServerHttpRequest.Builder.build.

Build a ServerHttpRequest decorator with the mutated properties.
public ServerHttpRequest.Builder
private URI
public ServerHttpRequest.Builder
header(String
the header name
headerName
,
String...
the header values
headerValues
)

Implements org.springframework.http.server.reactive.ServerHttpRequest.Builder.header.

Set or override the specified header values under the given name.
public ServerHttpRequest.Builder
public ServerHttpRequest.Builder
public ServerHttpRequest.Builder
path(String path)

Implements org.springframework.http.server.reactive.ServerHttpRequest.Builder.path.

Set the path to use instead of the "rawPath" of the URI of the request with the following conditions:
  • If uri is also set, the path given here overrides the path of the given URI.
  • If contextPath is also set, or already present, it must match the start of the path given here.
  • The given value must begin with a slash.
public ServerHttpRequest.Builder
public ServerHttpRequest.Builder
public ServerHttpRequest.Builder
uri(URI uri)

Implements org.springframework.http.server.reactive.ServerHttpRequest.Builder.uri.

Set the URI to use with the following conditions:
  • If path is also set, it overrides the path of the URI provided here.
  • If contextPath is also set, or already present, it must match the start of the path of the URI provided here.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bodyback to summary
private final Flux<DataBuffer> body
contextPathback to summary
private String contextPath
Annotations
@Nullable
headersback to summary
private final HttpHeaders headers
httpMethodback to summary
private HttpMethod httpMethod
originalRequestback to summary
private final ServerHttpRequest originalRequest
remoteAddressback to summary
private InetSocketAddress remoteAddress
Annotations
@Nullable
sslInfoback to summary
private SslInfo sslInfo
Annotations
@Nullable
uriback to summary
private URI uri
uriPathback to summary
private String uriPath
Annotations
@Nullable

Constructor Detail

DefaultServerHttpRequestBuilderback to summary
public DefaultServerHttpRequestBuilder(ServerHttpRequest original)

Method Detail

buildback to summary
public ServerHttpRequest build()

Implements org.springframework.http.server.reactive.ServerHttpRequest.Builder.build.

Doc from org.springframework.http.server.reactive.ServerHttpRequest.Builder.build.

Build a ServerHttpRequest decorator with the mutated properties.

Annotations
@Override
contextPathback to summary
public ServerHttpRequest.Builder contextPath(String contextPath)

Implements org.springframework.http.server.reactive.ServerHttpRequest.Builder.contextPath.

Doc from org.springframework.http.server.reactive.ServerHttpRequest.Builder.contextPath.

Set the contextPath to use.

The given value must be a valid contextPath and it must match the start of the path of the URI of the request. That means changing the contextPath, implies also changing the path via path(String).

Annotations
@Override
getUriToUseback to summary
private URI getUriToUse()
headerback to summary
public ServerHttpRequest.Builder header(String headerName, String... headerValues)

Implements org.springframework.http.server.reactive.ServerHttpRequest.Builder.header.

Doc from org.springframework.http.server.reactive.ServerHttpRequest.Builder.header.

Set or override the specified header values under the given name.

If you need to add header values, remove headers, etc., use headers(Consumer) for greater control.

Parameters
headerName:String

the header name

headerValues:String[]

the header values

Annotations
@Override
headersback to summary
public ServerHttpRequest.Builder headers(Consumer<HttpHeaders> headersConsumer)

Implements org.springframework.http.server.reactive.ServerHttpRequest.Builder.headers.

Doc from org.springframework.http.server.reactive.ServerHttpRequest.Builder.headers.

Manipulate request headers. The provided HttpHeaders contains current request headers, so that the Consumer can overwrite or remove existing values, or use any other HttpHeaders methods.

Annotations
@Override
methodback to summary
public ServerHttpRequest.Builder method(HttpMethod httpMethod)

Implements org.springframework.http.server.reactive.ServerHttpRequest.Builder.method.

Doc from org.springframework.http.server.reactive.ServerHttpRequest.Builder.method.

Set the HTTP method to return.

Annotations
@Override
pathback to summary
public ServerHttpRequest.Builder path(String path)

Implements org.springframework.http.server.reactive.ServerHttpRequest.Builder.path.

Doc from org.springframework.http.server.reactive.ServerHttpRequest.Builder.path.

Set the path to use instead of the "rawPath" of the URI of the request with the following conditions:

  • If uri is also set, the path given here overrides the path of the given URI.
  • If contextPath is also set, or already present, it must match the start of the path given here.
  • The given value must begin with a slash.
Annotations
@Override
remoteAddressback to summary
public ServerHttpRequest.Builder remoteAddress(InetSocketAddress remoteAddress)

Implements org.springframework.http.server.reactive.ServerHttpRequest.Builder.remoteAddress.

Doc from org.springframework.http.server.reactive.ServerHttpRequest.Builder.remoteAddress.

Set the address of the remote client.

Annotations
@Override
sslInfoback to summary
public ServerHttpRequest.Builder sslInfo(SslInfo sslInfo)

Implements org.springframework.http.server.reactive.ServerHttpRequest.Builder.sslInfo.

Doc from org.springframework.http.server.reactive.ServerHttpRequest.Builder.sslInfo.

Set the SSL session information. This may be useful in environments where TLS termination is done at the router, but SSL information is made available in some other way such as through a header.

Annotations
@Override
uriback to summary
public ServerHttpRequest.Builder uri(URI uri)

Implements org.springframework.http.server.reactive.ServerHttpRequest.Builder.uri.

Doc from org.springframework.http.server.reactive.ServerHttpRequest.Builder.uri.

Set the URI to use with the following conditions:

  • If path is also set, it overrides the path of the URI provided here.
  • If contextPath is also set, or already present, it must match the start of the path of the URI provided here.
Annotations
@Override
org.springframework.http.server.reactive back to summary

private Class DefaultServerHttpRequestBuilder.MutatedServerHttpRequest

extends AbstractServerHttpRequest
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Flux<DataBuffer>
private final ServerHttpRequest
private final InetSocketAddress
private final SslInfo

Constructor Summary

AccessConstructor and Description
public
MutatedServerHttpRequest(URI uri, String contextPath, HttpMethod method, SslInfo sslInfo, InetSocketAddress remoteAddress, HttpHeaders headers, Flux<DataBuffer> body, ServerHttpRequest originalRequest)

Method Summary

Modifier and TypeMethod and Description
public Flux<DataBuffer>
getBody()

Implements org.springframework.http.ReactiveHttpInputMessage.getBody.

Return the body of the message as a Publisher.
public String
getId()

Overrides org.springframework.http.server.reactive.AbstractServerHttpRequest.getId.

Implements org.springframework.http.server.reactive.ServerHttpRequest.getId.

Return an id that represents the underlying connection, if available, or the request for the purpose of correlating log messages.
public InetSocketAddress
getLocalAddress()

Overrides default org.springframework.http.server.reactive.ServerHttpRequest.getLocalAddress.

Return the local address the request was accepted on, if available.
public <T> T
public InetSocketAddress
getRemoteAddress()

Overrides default org.springframework.http.server.reactive.ServerHttpRequest.getRemoteAddress.

Return the remote address where this request is connected to, if available.
protected MultiValueMap<String, HttpCookie>
initCookies()

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpRequest.initCookies.

Obtain the cookies from the underlying "native" request and adapt those to an HttpCookie map.
protected SslInfo
initSslInfo()

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpRequest.initSslInfo.

Obtain SSL session information from the underlying "native" request.
Inherited from org.springframework.http.server.reactive.AbstractServerHttpRequest:
getCookiesgetHeadersgetLogPrefixgetMethodgetPathgetQueryParamsgetSslInfogetURIinitIdinitLogPrefixinitQueryParams

Field Detail

bodyback to summary
private final Flux<DataBuffer> body
originalRequestback to summary
private final ServerHttpRequest originalRequest
remoteAddressback to summary
private final InetSocketAddress remoteAddress
Annotations
@Nullable
sslInfoback to summary
private final SslInfo sslInfo

Hides org.springframework.http.server.reactive.AbstractServerHttpRequest.sslInfo.

Annotations
@Nullable

Constructor Detail

MutatedServerHttpRequestback to summary
public MutatedServerHttpRequest(URI uri, String contextPath, HttpMethod method, SslInfo sslInfo, InetSocketAddress remoteAddress, HttpHeaders headers, Flux<DataBuffer> body, ServerHttpRequest originalRequest)

Method Detail

getBodyback to summary
public Flux<DataBuffer> getBody()

Implements org.springframework.http.ReactiveHttpInputMessage.getBody.

Doc from org.springframework.http.ReactiveHttpInputMessage.getBody.

Return the body of the message as a Publisher.

Returns:Flux<DataBuffer>

the body content publisher

Annotations
@Override
getIdback to summary
public String getId()

Overrides org.springframework.http.server.reactive.AbstractServerHttpRequest.getId.

Implements org.springframework.http.server.reactive.ServerHttpRequest.getId.

Doc from org.springframework.http.server.reactive.ServerHttpRequest.getId.

Return an id that represents the underlying connection, if available, or the request for the purpose of correlating log messages.

Annotations
@Override
getLocalAddressback to summary
public InetSocketAddress getLocalAddress()

Overrides default org.springframework.http.server.reactive.ServerHttpRequest.getLocalAddress.

Doc from org.springframework.http.server.reactive.ServerHttpRequest.getLocalAddress.

Return the local address the request was accepted on, if available.

Annotations
@Override
@Nullable
getNativeRequestback to summary
public <T> T getNativeRequest()

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpRequest.getNativeRequest.

Doc from org.springframework.http.server.reactive.AbstractServerHttpRequest.getNativeRequest.

Return the underlying server response.

Note

This is exposed mainly for internal framework use such as WebSocket upgrades in the spring-webflux module.

Annotations
@SuppressWarnings:unchecked
@Override
getRemoteAddressback to summary
public InetSocketAddress getRemoteAddress()

Overrides default org.springframework.http.server.reactive.ServerHttpRequest.getRemoteAddress.

Doc from org.springframework.http.server.reactive.ServerHttpRequest.getRemoteAddress.

Return the remote address where this request is connected to, if available.

Annotations
@Override
@Nullable
initCookiesback to summary
protected MultiValueMap<String, HttpCookie> initCookies()

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpRequest.initCookies.

Doc from org.springframework.http.server.reactive.AbstractServerHttpRequest.initCookies.

Obtain the cookies from the underlying "native" request and adapt those to an HttpCookie map. The return value is turned into an immutable map and cached.

Note that this method is invoked lazily on access to getCookies(). Subclasses should synchronize cookie initialization if the underlying "native" request does not provide thread-safe access to cookie data.

Annotations
@Override
initSslInfoback to summary
protected SslInfo initSslInfo()

Implements abstract org.springframework.http.server.reactive.AbstractServerHttpRequest.initSslInfo.

Doc from org.springframework.http.server.reactive.AbstractServerHttpRequest.initSslInfo.

Obtain SSL session information from the underlying "native" request.

Returns:SslInfo

the session information, or null if none available

Annotations
@Override
@Nullable