public interface HttpServerRequest extends NettyInbound, HttpServerInfos
Modifier and Type | Method and Description |
---|---|
String |
forwardedPrefix()
Returns the X-Forwarded-Prefix if it was part of the request headers.
|
InetSocketAddress |
hostAddress()
Returns the address of the host which received the request, possibly
null in case of Unix Domain Sockets. |
boolean |
isFormUrlencoded()
Returns true if the request has
Content-Type with value application/x-www-form-urlencoded . |
boolean |
isMultipart()
Returns true if the request has
Content-Type with value multipart/form-data . |
String |
param(CharSequence key)
URI parameter captured via
{} e.g. |
Map<String,String> |
params()
Returns all URI parameters captured via
{} e.g. |
HttpServerRequest |
paramsResolver(Function<? super String,Map<String,String>> paramsResolver)
Specifies a params resolver.
|
String |
protocol()
Returns the inbound protocol and version.
|
default Flux<HttpContent> |
receiveContent()
Returns a
Flux of HttpContent containing received chunks. |
Flux<HttpData> |
receiveForm()
When the request is
POST and have Content-Type with value
application/x-www-form-urlencoded or multipart/form-data ,
returns a Flux of HttpData containing received Attribute /FileUpload . |
Flux<HttpData> |
receiveForm(Consumer<HttpServerFormDecoderProvider.Builder> formDecoderBuilder)
When the request is
POST and have Content-Type with value
application/x-www-form-urlencoded or multipart/form-data ,
returns a Flux of HttpData containing received Attribute /FileUpload . |
InetSocketAddress |
remoteAddress()
Returns the address of the client that initiated the request, possibly
null in case of Unix Domain Sockets. |
HttpHeaders |
requestHeaders()
Returns inbound
HttpHeaders . |
ZonedDateTime |
timestamp()
Returns the time when the request was received.
|
HttpServerRequest |
withConnection(Consumer<? super Connection> withConnection)
Calls the passed callback with a
Connection to operate on the
underlying Channel state. |
receive, receiveObject
allCookies
cookies, fullPath, isKeepAlive, isWebsocket, method, path, requestId, uri, version
connectionHostAddress, connectionRemoteAddress, connectionScheme, hostName, hostPort, scheme
HttpServerRequest withConnection(Consumer<? super Connection> withConnection)
NettyInbound
Connection
to operate on the
underlying Channel
state. This allows for chaining inbound API.withConnection
in interface NettyInbound
withConnection
- connection callbackConnection
@Nullable String param(CharSequence key)
{}
e.g. /test/{param}
.key
- parameter name e.g. "param"
in URI /test/{param}
@Nullable Map<String,String> params()
{}
e.g. /test/{param1}/{param2}
as key/value map.HttpServerRequest paramsResolver(Function<? super String,Map<String,String>> paramsResolver)
paramsResolver
- a params resolverHttpServerRequest
default Flux<HttpContent> receiveContent()
Flux
of HttpContent
containing received chunks.Flux
of HttpContent
containing received chunksboolean isFormUrlencoded()
Content-Type
with value application/x-www-form-urlencoded
.Content-Type
with value application/x-www-form-urlencoded
,
false - otherwiseboolean isMultipart()
Content-Type
with value multipart/form-data
.Content-Type
with value multipart/form-data
,
false - otherwiseFlux<HttpData> receiveForm()
POST
and have Content-Type
with value
application/x-www-form-urlencoded
or multipart/form-data
,
returns a Flux
of HttpData
containing received Attribute
/FileUpload
.
When the request is not POST
or does not have Content-Type
with value application/x-www-form-urlencoded
or multipart/form-data
,
a Flux.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 each HttpData
published,
retaining in order to prevent premature recycling when HttpData
is accumulated downstream.
Flux
of HttpData
containing received Attribute
/FileUpload
Flux<HttpData> receiveForm(Consumer<HttpServerFormDecoderProvider.Builder> formDecoderBuilder)
POST
and have Content-Type
with value
application/x-www-form-urlencoded
or multipart/form-data
,
returns a Flux
of HttpData
containing received Attribute
/FileUpload
.
When the request is not POST
or does not have Content-Type
with value application/x-www-form-urlencoded
or multipart/form-data
,
a Flux.error(Throwable)
will be returned.
HttpData.retain()
disables auto memory release on each HttpData
published,
retaining in order to prevent premature recycling when HttpData
is accumulated downstream.
formDecoderBuilder
- HttpServerFormDecoderProvider.Builder
for HTTP form decoder configurationFlux
of HttpData
containing received Attribute
/FileUpload
@Nullable InetSocketAddress hostAddress()
ConnectionInformation
null
in case of Unix Domain Sockets.
The returned address is the merged information from all proxies.hostAddress
in interface ConnectionInformation
@Nullable InetSocketAddress remoteAddress()
ConnectionInformation
null
in case of Unix Domain Sockets.
The returned address is the merged information from all proxies.remoteAddress
in interface ConnectionInformation
HttpHeaders requestHeaders()
HttpHeaders
.HttpHeaders
String protocol()
ZonedDateTime timestamp()