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 String
Returns the X-Forwarded-Prefix if it was part of the request headers.@Nullable InetSocketAddress
Returns the address of the host which received the request, possiblynull
in case of Unix Domain Sockets.boolean
Returns true if the request hasContent-Type
with valueapplication/x-www-form-urlencoded
.boolean
Returns true if the request hasContent-Type
with valuemultipart/form-data
.@Nullable String
param
(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 aFlux
ofHttpContent
containing received chunks.When the request isPOST
and haveContent-Type
with valueapplication/x-www-form-urlencoded
ormultipart/form-data
, returns aFlux
ofHttpData
containing receivedAttribute
/FileUpload
.receiveForm
(Consumer<HttpServerFormDecoderProvider.Builder> formDecoderBuilder) When the request isPOST
and haveContent-Type
with valueapplication/x-www-form-urlencoded
ormultipart/form-data
, returns aFlux
ofHttpData
containing receivedAttribute
/FileUpload
.@Nullable InetSocketAddress
Returns the address of the client that initiated the request, possiblynull
in 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 aConnection
to operate on the underlyingChannel
state.Methods inherited from interface reactor.netty.http.server.ConnectionInformation
connectionHostAddress, connectionRemoteAddress, connectionScheme, hostName, hostPort, scheme
Methods inherited from interface reactor.netty.http.HttpInfos
cookies, fullPath, isKeepAlive, isWebsocket, method, path, requestId, uri, version
Methods inherited from interface reactor.netty.http.server.HttpServerInfos
allCookies
Methods inherited from interface reactor.netty.NettyInbound
receive, receiveObject
-
Method Details
-
withConnection
Description copied from interface:NettyInbound
Calls the passed callback with aConnection
to operate on the underlyingChannel
state. This allows for chaining inbound API.- Specified by:
withConnection
in 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 aFlux
ofHttpContent
containing received chunks.- Returns:
- a
Flux
ofHttpContent
containing received chunks
-
isFormUrlencoded
boolean isFormUrlencoded()Returns true if the request hasContent-Type
with valueapplication/x-www-form-urlencoded
.- Returns:
- true if the request has
Content-Type
with valueapplication/x-www-form-urlencoded
, false - otherwise - Since:
- 1.0.11
-
isMultipart
boolean isMultipart()Returns true if the request hasContent-Type
with valuemultipart/form-data
.- Returns:
- true if the request has
Content-Type
with valuemultipart/form-data
, false - otherwise - Since:
- 1.0.11
-
receiveForm
When the request isPOST
and haveContent-Type
with valueapplication/x-www-form-urlencoded
ormultipart/form-data
, returns aFlux
ofHttpData
containing receivedAttribute
/FileUpload
. When the request is notPOST
or does not haveContent-Type
with valueapplication/x-www-form-urlencoded
ormultipart/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 eachHttpData
published, retaining in order to prevent premature recycling whenHttpData
is accumulated downstream.- Returns:
- a
Flux
ofHttpData
containing receivedAttribute
/FileUpload
- Since:
- 1.0.11
-
receiveForm
When the request isPOST
and haveContent-Type
with valueapplication/x-www-form-urlencoded
ormultipart/form-data
, returns aFlux
ofHttpData
containing receivedAttribute
/FileUpload
. When the request is notPOST
or does not haveContent-Type
with valueapplication/x-www-form-urlencoded
ormultipart/form-data
, aFlux.error(Throwable)
will be returned.HttpData.retain()
disables auto memory release on eachHttpData
published, retaining in order to prevent premature recycling whenHttpData
is accumulated downstream.- Parameters:
formDecoderBuilder
-HttpServerFormDecoderProvider.Builder
for HTTP form decoder configuration- Returns:
- a
Flux
ofHttpData
containing receivedAttribute
/FileUpload
- Since:
- 1.0.11
-
hostAddress
@Nullable InetSocketAddress hostAddress()Description copied from interface:ConnectionInformation
Returns the address of the host which received the request, possiblynull
in case of Unix Domain Sockets. The returned address is the merged information from all proxies.- Specified by:
hostAddress
in interfaceConnectionInformation
- Returns:
- the address merged from all proxies of the host which received the request
-
remoteAddress
@Nullable InetSocketAddress remoteAddress()Description copied from interface:ConnectionInformation
Returns the address of the client that initiated the request, possiblynull
in case of Unix Domain Sockets. The returned address is the merged information from all proxies.- Specified by:
remoteAddress
in 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
-