public class HttpToH2Operations extends HttpOperations<HttpServerRequest,HttpServerResponse>
HttpOperations.PostHeadersNettyOutboundChannelOperations.OnSetupDisposable.Composite, Disposable.Swap| Modifier and Type | Method and Description |
|---|---|
HttpServerResponse |
addCookie(Cookie cookie)
Adds an outbound cookie
|
HttpServerResponse |
addHeader(CharSequence name,
CharSequence value)
Adds an outbound HTTP header, appending the value if the header already exist.
|
reactor.netty.http.server.HttpServerOperations |
chunkedTransfer(boolean chunked)
Sets Transfer-Encoding header
|
HttpServerResponse |
compression(boolean compress)
Enables/Disables compression handling (gzip/deflate) for the underlying response
|
Map<CharSequence,Set<Cookie>> |
cookies()
Returns resolved HTTP cookies
|
HttpServerResponse |
header(CharSequence name,
CharSequence value)
Sets an outbound HTTP header, replacing any pre-existing value.
|
HttpServerResponse |
headers(HttpHeaders headers)
Sets outbound HTTP headers, replacing any pre-existing value for these headers.
|
InetSocketAddress |
hostAddress()
Returns the address of the host peer.
|
boolean |
isKeepAlive()
Is the request keep alive
|
boolean |
isWebsocket()
Returns true if websocket connection (upgraded)
|
HttpServerResponse |
keepAlive(boolean keepAlive)
Sets the request
keepAlive if true otherwise remove the existing connection keep alive header |
HttpMethod |
method()
Returns the resolved request method (HTTP 1.1 etc)
|
protected HttpMessage |
newFullBodyMessage(ByteBuf body) |
protected void |
onInboundNext(ChannelHandlerContext ctx,
Object msg)
React on inbound
Channel.read() |
protected void |
onOutboundComplete()
React on inbound/outbound completion (last packet)
|
protected void |
onOutboundError(Throwable err)
There is no need of invoking
ChannelOperations.discard(), the inbound will
be canceled on channel inactive event if there is no subscriber available |
reactor.netty.http.server.HttpServerOperations |
options(java.util.function.Consumer<? super NettyPipeline.SendOptions> configurator)
Provides a new
NettyOutbound scoped configuration for sending. |
protected HttpMessage |
outboundHttpMessage()
Outbound Netty HttpMessage
|
String |
param(CharSequence key)
URI parameter captured via {} "/test/{var}"
|
Map<String,String> |
params()
Returns the param captured key/value map
|
HttpServerRequest |
paramsResolver(java.util.function.Function<? super String,Map<String,String>> headerResolver) |
protected void |
preSendHeadersAndStatus() |
Flux<?> |
receiveObject()
a Object inbound
Flux |
InetSocketAddress |
remoteAddress()
Returns the address of the remote peer.
|
HttpHeaders |
requestHeaders()
Returns inbound
HttpHeaders |
HttpHeaders |
responseHeaders()
Returns the outbound HTTP headers, sent back to the clients
|
String |
scheme()
Returns the current protocol scheme
|
Mono<Void> |
send()
Sends the HTTP headers and empty content thus delimiting a full empty body http response.
|
NettyOutbound |
sendFile(Path file)
Sends content from given
Path using
FileChannel.transferTo(long, long, WritableByteChannel)
support. |
NettyOutbound |
sendHeaders()
Returns a
NettyOutbound successful on committed response |
Mono<Void> |
sendNotFound()
Sends 404 status
HttpResponseStatus.NOT_FOUND. |
Mono<Void> |
sendRedirect(String location)
Sends redirect status
HttpResponseStatus.FOUND along with a location
header to the remote client. |
Mono<Void> |
sendWebsocket(String protocols,
int maxFramePayloadLength,
java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> websocketHandler)
Upgrades the connection to websocket with optional subprotocol(s).
|
HttpServerResponse |
sse()
Adds "text/event-stream" content-type for Server-Sent Events
|
HttpResponseStatus |
status()
Returns the assigned HTTP status
|
HttpServerResponse |
status(HttpResponseStatus status)
Sets an HTTP status to be sent along with the headers
|
String |
uri()
Returns the resolved target address
|
HttpVersion |
version()
Returns the resolved request version (HTTP 1.1 etc)
|
reactor.netty.http.server.HttpServerOperations |
withConnection(java.util.function.Consumer<? super Connection> withConnection)
Calls the passed callback with a
Connection to operate on the
underlying Channel state. |
addHandler, hasSentHeaders, markSentBody, markSentHeaderAndBody, markSentHeaders, send, sendFile, sendObject, then, toStringaddReactiveBridge, alloc, as, channel, connection, currentContext, discard, dispose, disposeSubscriber, formatName, get, inbound, isDisposed, isInboundCancelled, isInboundDisposed, isPersistent, listener, onComplete, onDispose, onDispose, onError, onInboundCancel, onInboundClose, onInboundComplete, onInboundError, onNext, onSubscribe, onTerminate, outbound, receive, sendObject, sendUsing, terminateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitreceiveContentreceivehasSentHeaders, sendWebsocket, sendWebsocket, statusalloc, neverComplete, send, sendByteArray, sendFile, sendFileChunked, sendGroups, sendObject, sendObject, sendString, sendString, sendUsing, subscribe, then, then, thenaddHandler, addHandlerFirst, addHandlerFirst, addHandlerLast, addHandlerLast, bind, from, markPersistent, onReadIdle, onWriteIdle, rebind, removeHandler, replaceHandleraddress, disposeNow, disposeNowprotected void onInboundNext(ChannelHandlerContext ctx, Object msg)
ChannelOperationsChannel.read()ctx - the contextmsg - the read payloadpublic NettyOutbound sendHeaders()
HttpServerResponseNettyOutbound successful on committed responsesendHeaders in interface HttpServerResponseNettyOutbound successful on committed responsepublic reactor.netty.http.server.HttpServerOperations withConnection(java.util.function.Consumer<? super Connection> withConnection)
NettyInboundConnection to operate on the
underlying Channel state. This allows for chaining inbound API.withConnection in interface HttpServerRequestwithConnection in interface HttpServerResponsewithConnection in interface NettyInboundwithConnection in interface NettyOutboundwithConnection in class ChannelOperations<HttpServerRequest,HttpServerResponse>withConnection - connection callbackConnectionprotected HttpMessage newFullBodyMessage(ByteBuf body)
newFullBodyMessage in class HttpOperations<HttpServerRequest,HttpServerResponse>public HttpServerResponse addCookie(Cookie cookie)
HttpServerResponseaddCookie in interface HttpServerResponseHttpServerResponsepublic HttpServerResponse addHeader(CharSequence name, CharSequence value)
HttpServerResponseaddHeader in interface HttpServerResponsename - header namevalue - header valueHttpServerResponsepublic reactor.netty.http.server.HttpServerOperations chunkedTransfer(boolean chunked)
HttpServerResponsechunkedTransfer in interface HttpServerResponsechunked - true if Transfer-Encoding: chunkedHttpServerResponsepublic Map<CharSequence,Set<Cookie>> cookies()
HttpInfospublic HttpServerResponse header(CharSequence name, CharSequence value)
HttpServerResponseheader in interface HttpServerResponsename - headers keyvalue - header valueHttpServerResponsepublic HttpServerResponse headers(HttpHeaders headers)
HttpServerResponseheaders in interface HttpServerResponseheaders - netty headers mapHttpServerResponsepublic boolean isKeepAlive()
HttpInfosisKeepAlive in interface HttpInfospublic boolean isWebsocket()
HttpInfosisWebsocket in interface HttpInfosisWebsocket in class HttpOperations<HttpServerRequest,HttpServerResponse>public HttpServerResponse keepAlive(boolean keepAlive)
HttpServerResponsekeepAlive if true otherwise remove the existing connection keep alive headerkeepAlive in interface HttpServerResponseHttpServerResponsepublic HttpMethod method()
HttpInfos@Nullable public String param(CharSequence key)
HttpServerRequestparam in interface HttpServerRequestkey - param var name@Nullable public Map<String,String> params()
HttpServerRequestparams in interface HttpServerRequestpublic HttpServerRequest paramsResolver(java.util.function.Function<? super String,Map<String,String>> headerResolver)
paramsResolver in interface HttpServerRequestheaderResolver - provide a paramsHttpServerRequestpublic Flux<?> receiveObject()
NettyInboundFluxreceiveObject in interface NettyInboundreceiveObject in class ChannelOperations<HttpServerRequest,HttpServerResponse>Fluxpublic InetSocketAddress hostAddress()
HttpServerRequesthostAddress in interface HttpServerRequestpublic InetSocketAddress remoteAddress()
HttpServerRequestremoteAddress in interface HttpServerRequestpublic HttpHeaders requestHeaders()
HttpServerRequestHttpHeadersrequestHeaders in interface HttpServerRequestHttpHeaderspublic reactor.netty.http.server.HttpServerOperations options(java.util.function.Consumer<? super NettyPipeline.SendOptions> configurator)
NettyOutboundNettyOutbound scoped configuration for sending. The
NettyPipeline.SendOptions changes will be applied to the next written object or
Publisher.options in interface HttpServerResponseoptions in interface NettyOutboundoptions in class ChannelOperations<HttpServerRequest,HttpServerResponse>configurator - the callback invoked to retrieve send configurationNettyOutboundpublic String scheme()
HttpServerRequestscheme in interface HttpServerRequestpublic HttpHeaders responseHeaders()
HttpServerResponseresponseHeaders in interface HttpServerResponsepublic Mono<Void> send()
HttpServerResponsesend in interface HttpServerResponseMono successful on committed responseNettyOutbound.send(Publisher)public NettyOutbound sendFile(Path file)
NettyOutboundPath using
FileChannel.transferTo(long, long, WritableByteChannel)
support. If the system supports it and the path resolves to a local file
system File then transfer will use zero-byte copy
to the peer.
It will listen for any error on write and close on terminal signal (complete|error). If more than one publisher is attached (multiple calls to send()) completion occurs after all publishers complete.
Note: this will emit FileRegion in the outbound
ChannelPipeline
Note: Nesting any send* method is not supported.
sendFile in interface NettyOutboundfile - the file Pathpublic Mono<Void> sendNotFound()
HttpServerResponseHttpResponseStatus.NOT_FOUND.sendNotFound in interface HttpServerResponseMono successful on flush confirmationpublic Mono<Void> sendRedirect(String location)
HttpServerResponseHttpResponseStatus.FOUND along with a location
header to the remote client.sendRedirect in interface HttpServerResponselocation - the location to redirect toMono successful on flush confirmationpublic HttpServerResponse sse()
HttpServerResponsesse in interface HttpServerResponsepublic HttpResponseStatus status()
HttpServerResponsestatus in interface HttpServerResponsepublic HttpServerResponse status(HttpResponseStatus status)
HttpServerResponsestatus in interface HttpServerResponsestatus - an HTTP status to be sent along with the headersHttpServerResponsepublic Mono<Void> sendWebsocket(@Nullable String protocols, int maxFramePayloadLength, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> websocketHandler)
HttpServerResponseMono
completing when the upgrade is confirmed, then the provided callback is invoked,
if the upgrade is not successful the returned Mono fails.sendWebsocket in interface HttpServerResponseprotocols - optional sub-protocolmaxFramePayloadLength - maximum allowable frame payload lengthwebsocketHandler - the I/O handler for websocket transportMono completing when upgrade is confirmed, otherwise failspublic String uri()
HttpInfospublic HttpVersion version()
HttpInfospublic HttpServerResponse compression(boolean compress)
HttpServerResponsecompression in interface HttpServerResponsecompress - should handle compressionHttpServerResponseprotected void preSendHeadersAndStatus()
preSendHeadersAndStatus in class HttpOperations<HttpServerRequest,HttpServerResponse>protected void onOutboundComplete()
ChannelOperationsonOutboundComplete in class ChannelOperations<HttpServerRequest,HttpServerResponse>protected void onOutboundError(Throwable err)
ChannelOperations.discard(), the inbound will
be canceled on channel inactive event if there is no subscriber availableonOutboundError in class ChannelOperations<HttpServerRequest,HttpServerResponse>err - the Throwable causeprotected HttpMessage outboundHttpMessage()
HttpOperationsoutboundHttpMessage in class HttpOperations<HttpServerRequest,HttpServerResponse>