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

pack-priv Class UndertowServerHttpRequest

extends AbstractServerHttpRequest
Class Inheritance
Imports
java.io.IOException, java.net.InetSocketAddress, .URI, .URISyntaxException, java.nio.ByteBuffer, java.util.concurrent.atomic.AtomicLong, javax.net.ssl.SSLSession, io.undertow.connector.ByteBufferPool, .PooledByteBuffer, io.undertow.server.HttpServerExchange, io.undertow.server.handlers.Cookie, org.xnio.channels.StreamSourceChannel, reactor.core.publisher.Flux, org.springframework.core.io.buffer.DataBuffer, .DataBufferFactory, org.springframework.http.HttpCookie, .HttpMethod, org.springframework.lang.Nullable, org.springframework.util.Assert, .LinkedMultiValueMap, .MultiValueMap, .ObjectUtils, .StringUtils

Adapt ServerHttpRequest to the Undertow HttpServerExchange.
Authors
Marek Hawrylczak, Rossen Stoyanchev, Juergen Hoeller
Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final UndertowServerHttpRequest.RequestBodyPublisher
private final HttpServerExchange
private static final AtomicLong

Constructor Summary

AccessConstructor and Description
public

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 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 String
initId()

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

Obtain the request id to use, or null in which case the Object identity of this request instance is used.

protected SslInfo
initSslInfo()

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

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

private static URI
Inherited from org.springframework.http.server.reactive.AbstractServerHttpRequest:
getCookiesgetHeadersgetIdgetLogPrefixgetMethodgetPathgetQueryParamsgetSslInfogetURIinitLogPrefixinitQueryParams

Field Detail

bodyback to summary
private final UndertowServerHttpRequest.RequestBodyPublisher body
exchangeback to summary
private final HttpServerExchange exchange
logPrefixIndexback to summary
private static final AtomicLong logPrefixIndex

Constructor Detail

UndertowServerHttpRequestback to summary
public UndertowServerHttpRequest(HttpServerExchange exchange, DataBufferFactory bufferFactory) throws URISyntaxException

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
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
initIdback to summary
protected String initId()

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

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

Obtain the request id to use, or null in which case the Object identity of this request instance is used.

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
@Nullable
@Override
initUriback to summary
private static URI initUri(HttpServerExchange exchange) throws URISyntaxException
org.springframework.http.server.reactive back to summary

private Class UndertowServerHttpRequest.RequestBodyPublisher

extends AbstractListenerReadPublisher<DataBuffer>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final DataBufferFactory
private final ByteBufferPool
private final StreamSourceChannel
Inherited from org.springframework.http.server.reactive.AbstractListenerReadPublisher:
EMPTY_BUFFERrsReadLogger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
checkOnDataAvailable()

Implements abstract org.springframework.http.server.reactive.AbstractListenerReadPublisher.checkOnDataAvailable.

Check if data is available and either call onDataAvailable() immediately or schedule a notification.

protected void
discardData()

Implements abstract org.springframework.http.server.reactive.AbstractListenerReadPublisher.discardData.

Invoked after an I/O read error from the underlying server or after a cancellation signal from the downstream consumer to allow subclasses to discard any current cached data they might have.

protected DataBuffer
read()

Implements abstract org.springframework.http.server.reactive.AbstractListenerReadPublisher.read.

Read once from the input, if possible.

protected void
readingPaused()

Implements abstract org.springframework.http.server.reactive.AbstractListenerReadPublisher.readingPaused.

Invoked when reading is paused due to a lack of demand.

private void
Inherited from org.springframework.http.server.reactive.AbstractListenerReadPublisher:
getLogPrefixonAllDataReadonDataAvailableonErrorsubscribe

Field Detail

bufferFactoryback to summary
private final DataBufferFactory bufferFactory
byteBufferPoolback to summary
private final ByteBufferPool byteBufferPool
channelback to summary
private final StreamSourceChannel channel

Constructor Detail

RequestBodyPublisherback to summary
public RequestBodyPublisher(HttpServerExchange exchange, DataBufferFactory bufferFactory)

Method Detail

checkOnDataAvailableback to summary
protected void checkOnDataAvailable()

Implements abstract org.springframework.http.server.reactive.AbstractListenerReadPublisher.checkOnDataAvailable.

Doc from org.springframework.http.server.reactive.AbstractListenerReadPublisher.checkOnDataAvailable.

Check if data is available and either call onDataAvailable() immediately or schedule a notification.

Annotations
@Override
discardDataback to summary
protected void discardData()

Implements abstract org.springframework.http.server.reactive.AbstractListenerReadPublisher.discardData.

Doc from org.springframework.http.server.reactive.AbstractListenerReadPublisher.discardData.

Invoked after an I/O read error from the underlying server or after a cancellation signal from the downstream consumer to allow subclasses to discard any current cached data they might have.

Annotations
@Override
readback to summary
protected DataBuffer read() throws IOException

Implements abstract org.springframework.http.server.reactive.AbstractListenerReadPublisher.read.

Doc from org.springframework.http.server.reactive.AbstractListenerReadPublisher.read.

Read once from the input, if possible.

Returns:DataBuffer

the item that was read; or null

Annotations
@Override
@Nullable
readingPausedback to summary
protected void readingPaused()

Implements abstract org.springframework.http.server.reactive.AbstractListenerReadPublisher.readingPaused.

Doc from org.springframework.http.server.reactive.AbstractListenerReadPublisher.readingPaused.

Invoked when reading is paused due to a lack of demand.

Note

This method is guaranteed not to compete with checkOnDataAvailable() so it can be used to safely suspend reading, if the underlying API supports it, i.e. without competing with an implicit call to resume via checkOnDataAvailable().

Annotations
@Override
registerListenersback to summary
private void registerListeners(HttpServerExchange exchange)