Package reactor.netty.http.server
Interface HttpServerRequest
- All Superinterfaces:
ConnectionInformation,HttpInfos,HttpServerInfos,NettyInbound
An Http Reactive Channel with several accessors related to HTTP flow: headers, params,
URI, method, websocket...
- Since:
- 0.5
- Author:
- Stephane Maldini
-
Method Summary
Modifier and TypeMethodDescription@Nullable StringReturns the X-Forwarded-Prefix if it was part of the request headers.@Nullable InetSocketAddressReturns the address of the host which received the request, possiblynullin case of Unix Domain Sockets.booleanReturns true if the request hasContent-Typewith valueapplication/x-www-form-urlencoded.booleanReturns true if the request hasContent-Typewith valuemultipart/form-data.@Nullable Stringparam(CharSequence key) URI parameter captured via{}e.g.params()Returns all URI parameters captured via{}e.g.Specifies a params resolver.protocol()Returns the inbound protocol and version.default Flux<HttpContent>Returns aFluxofHttpContentcontaining received chunks.When the request isPOSTand haveContent-Typewith valueapplication/x-www-form-urlencodedormultipart/form-data, returns aFluxofHttpDatacontaining receivedAttribute/FileUpload.receiveForm(Consumer<HttpServerFormDecoderProvider.Builder> formDecoderBuilder) When the request isPOSTand haveContent-Typewith valueapplication/x-www-form-urlencodedormultipart/form-data, returns aFluxofHttpDatacontaining receivedAttribute/FileUpload.@Nullable InetSocketAddressReturns the address of the client that initiated the request, possiblynullin case of Unix Domain Sockets.Returns inboundHttpHeaders.Returns the time when the request was received.withConnection(Consumer<? super Connection> withConnection) Calls the passed callback with aConnectionto operate on the underlyingChannelstate.Methods inherited from interface reactor.netty.http.server.ConnectionInformation
connectionHostAddress, connectionRemoteAddress, connectionScheme, hostName, hostPort, schemeMethods inherited from interface reactor.netty.http.HttpInfos
cookies, fullPath, isKeepAlive, isWebsocket, method, path, requestId, uri, versionMethods inherited from interface reactor.netty.http.server.HttpServerInfos
allCookiesMethods inherited from interface reactor.netty.NettyInbound
receive, receiveObject
-
Method Details
-
withConnection
Description copied from interface:NettyInboundCalls the passed callback with aConnectionto operate on the underlyingChannelstate. This allows for chaining inbound API.- Specified by:
withConnectionin interfaceNettyInbound- Parameters:
withConnection- connection callback- Returns:
- the
Connection
-
param
URI parameter captured via{}e.g./test/{param}.- Parameters:
key- parameter name e.g."param"in URI/test/{param}- Returns:
- the parameter captured value
-
params
Returns all URI parameters captured via{}e.g./test/{param1}/{param2}as key/value map.- Returns:
- the parameters captured key/value map
-
paramsResolver
HttpServerRequest paramsResolver(@Nullable Function<? super String, Map<String, String>> paramsResolver) Specifies a params resolver.- Parameters:
paramsResolver- a params resolver- Returns:
- this
HttpServerRequest
-
receiveContent
Returns aFluxofHttpContentcontaining received chunks.- Returns:
- a
FluxofHttpContentcontaining received chunks
-
isFormUrlencoded
boolean isFormUrlencoded()Returns true if the request hasContent-Typewith valueapplication/x-www-form-urlencoded.- Returns:
- true if the request has
Content-Typewith valueapplication/x-www-form-urlencoded, false - otherwise - Since:
- 1.0.11
-
isMultipart
boolean isMultipart()Returns true if the request hasContent-Typewith valuemultipart/form-data.- Returns:
- true if the request has
Content-Typewith valuemultipart/form-data, false - otherwise - Since:
- 1.0.11
-
receiveForm
When the request isPOSTand haveContent-Typewith valueapplication/x-www-form-urlencodedormultipart/form-data, returns aFluxofHttpDatacontaining receivedAttribute/FileUpload. When the request is notPOSTor does not haveContent-Typewith valueapplication/x-www-form-urlencodedormultipart/form-data, aFlux.error(Throwable)will be returned.Uses HTTP form decoder configuration specified on server level or the default one if nothing is configured.
HttpData.retain()disables auto memory release on eachHttpDatapublished, retaining in order to prevent premature recycling whenHttpDatais accumulated downstream.- Returns:
- a
FluxofHttpDatacontaining receivedAttribute/FileUpload - Since:
- 1.0.11
-
receiveForm
When the request isPOSTand haveContent-Typewith valueapplication/x-www-form-urlencodedormultipart/form-data, returns aFluxofHttpDatacontaining receivedAttribute/FileUpload. When the request is notPOSTor does not haveContent-Typewith valueapplication/x-www-form-urlencodedormultipart/form-data, aFlux.error(Throwable)will be returned.HttpData.retain()disables auto memory release on eachHttpDatapublished, retaining in order to prevent premature recycling whenHttpDatais accumulated downstream.- Parameters:
formDecoderBuilder-HttpServerFormDecoderProvider.Builderfor HTTP form decoder configuration- Returns:
- a
FluxofHttpDatacontaining receivedAttribute/FileUpload - Since:
- 1.0.11
-
hostAddress
@Nullable InetSocketAddress hostAddress()Description copied from interface:ConnectionInformationReturns the address of the host which received the request, possiblynullin case of Unix Domain Sockets. The returned address is the merged information from all proxies.- Specified by:
hostAddressin interfaceConnectionInformation- Returns:
- the address merged from all proxies of the host which received the request
-
remoteAddress
@Nullable InetSocketAddress remoteAddress()Description copied from interface:ConnectionInformationReturns the address of the client that initiated the request, possiblynullin case of Unix Domain Sockets. The returned address is the merged information from all proxies.- Specified by:
remoteAddressin interfaceConnectionInformation- Returns:
- the address merged from all proxies of the client that initiated the request
-
requestHeaders
HttpHeaders requestHeaders()Returns inboundHttpHeaders.- Returns:
- inbound
HttpHeaders
-
protocol
String protocol()Returns the inbound protocol and version.- Returns:
- the inbound protocol and version
- Since:
- 1.0.28
-
timestamp
ZonedDateTime timestamp()Returns the time when the request was received.- Returns:
- the time when the request was received
- Since:
- 1.0.28
-
forwardedPrefix
@Nullable String forwardedPrefix()Returns the X-Forwarded-Prefix if it was part of the request headers.- Returns:
- the X-Forwarded-Prefix
- Since:
- 1.1.23
-