public class HttpToH2Operations extends HttpOperations<HttpServerRequest,HttpServerResponse>
ChannelOperations.OnSetupDisposable.Composite, Disposable.Swap| Modifier and Type | Method and Description |
|---|---|
HttpServerResponse |
addCookie(Cookie cookie)
Add an outbound cookie
|
HttpServerResponse |
addHeader(CharSequence name,
CharSequence value)
Add an outbound http header, appending the value if the header already exist.
|
reactor.netty.http.server.HttpServerOperations |
chunkedTransfer(boolean chunked)
Set transfer-encoding header
|
HttpServerResponse |
compression(boolean compress)
Enable/Disable compression handling (gzip/deflate) for the underlying response
|
Map<CharSequence,Set<Cookie>> |
cookies()
Return resolved HTTP cookies
|
HttpServerResponse |
header(CharSequence name,
CharSequence value)
Set an outbound header, replacing any pre-existing value.
|
HttpServerResponse |
headers(HttpHeaders headers)
Set outbound headers, replacing any pre-existing value for these headers.
|
InetSocketAddress |
hostAddress()
Return the address of the host peer.
|
boolean |
isKeepAlive()
Is the request keepAlive
|
boolean |
isWebsocket()
Return true if websocket connection (upgraded)
|
HttpServerResponse |
keepAlive(boolean keepAlive)
Set the request keepAlive if true otherwise remove the existing connection keep alive header
|
HttpMethod |
method()
Return the resolved request method (HTTP 1.1 etc)
|
protected HttpMessage |
newFullEmptyBodyMessage() |
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)
React on inbound/outbound error
|
protected HttpMessage |
outboundHttpMessage()
Outbound Netty HttpMessage
|
String |
param(CharSequence key)
URI parameter captured via {} "/test/{var}"
|
Map<String,String> |
params()
Return 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()
Return the address of the remote peer.
|
HttpHeaders |
requestHeaders()
Return inbound
HttpHeaders |
HttpHeaders |
responseHeaders()
Return headers sent back to the clients
|
String |
scheme()
Return the current scheme
|
Mono<Void> |
send()
Send headers and empty content thus delimiting a full empty body http response.
|
NettyOutbound |
sendFile(Path file)
Send content from given
Path using
FileChannel.transferTo(long, long, WritableByteChannel)
support. |
NettyOutbound |
sendHeaders()
Return a
NettyOutbound successful on committed response |
Mono<Void> |
sendNotFound()
Send 404 status
HttpResponseStatus.NOT_FOUND. |
Mono<Void> |
sendRedirect(String location)
Send 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)
Upgrade connection to Websocket with optional subprotocol(s).
|
HttpServerResponse |
sse()
Add "text/event-stream" content-type for Server-Sent Events
|
HttpResponseStatus |
status()
Return the assigned HTTP status
|
HttpServerResponse |
status(HttpResponseStatus status)
Set an HTTP status to be sent along with the headers
|
String |
uri()
Return the resolved target address
|
HttpVersion |
version()
Return the resolved request version (HTTP 1.1 etc)
|
reactor.netty.http.server.HttpServerOperations |
withConnection(java.util.function.Consumer<? super Connection> withConnection)
Call the passed callback with a
Connection to operate on the
underlying
Channel state. |
addHandler, hasSentHeaders, markSentBody, markSentHeaderAndBody, markSentHeaders, sendFile, then, toStringaddListener, addListeners, addReactiveBridge, alloc, as, await, awaitUninterruptibly, channel, connection, currentContext, discard, dispose, disposeSubscriber, formatName, get, inbound, isDisposed, isInboundCancelled, isInboundDisposed, isPersistent, isVoid, listener, onComplete, onDispose, onDispose, onError, onInboundCancel, onInboundClose, onInboundComplete, onInboundError, onNext, onSubscribe, onTerminate, outbound, receive, removeListener, removeListeners, sendObject, sendObject, sendUsing, setFailure, setSuccess, setSuccess, sync, syncUninterruptibly, terminate, trySuccess, unvoidawait, await, awaitUninterruptibly, awaitUninterruptibly, cancel, cause, checkDeadLock, executor, getNow, isCancellable, isCancelled, isDone, isSuccess, notifyListener, setUncancellable, toStringBuilder, tryFailure, trySuccessget, getclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitreceiveContentreceivehasSentHeaders, options, sendWebsocket, sendWebsocket, statusalloc, neverComplete, send, sendByteArray, sendFile, sendFileChunked, sendGroups, sendObject, sendObject, sendString, sendString, sendUsing, subscribe, then, thenaddHandler, addHandlerFirst, addHandlerFirst, addHandlerLast, addHandlerLast, bind, from, markPersistent, onReadIdle, onWriteIdle, rebind, removeHandler, replaceHandleraddress, disposeNow, disposeNowsetUncancellable, tryFailure, trySuccessawait, await, awaitUninterruptibly, awaitUninterruptibly, cancel, cause, getNow, isCancellable, isSuccessget, get, isCancelled, isDoneprotected 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 newFullEmptyBodyMessage()
newFullEmptyBodyMessage in class HttpOperations<HttpServerRequest,HttpServerResponse>public HttpServerResponse addCookie(Cookie cookie)
HttpServerResponseaddCookie in interface HttpServerResponsepublic HttpServerResponse addHeader(CharSequence name, CharSequence value)
HttpServerResponseaddHeader in interface HttpServerResponsename - header namevalue - header valuepublic reactor.netty.http.server.HttpServerOperations chunkedTransfer(boolean chunked)
HttpServerResponsechunkedTransfer in interface HttpServerResponsechunked - true if transfer-encoding:chunkedpublic Map<CharSequence,Set<Cookie>> cookies()
HttpInfospublic HttpServerResponse header(CharSequence name, CharSequence value)
HttpServerResponseheader in interface HttpServerResponsename - headers keyvalue - header valuepublic HttpServerResponse headers(HttpHeaders headers)
HttpServerResponseheaders in interface HttpServerResponseheaders - netty headers mappublic boolean isKeepAlive()
HttpInfosisKeepAlive in interface HttpInfospublic boolean isWebsocket()
HttpInfosisWebsocket in interface HttpInfosisWebsocket in class HttpOperations<HttpServerRequest,HttpServerResponse>public HttpServerResponse keepAlive(boolean keepAlive)
HttpServerResponsekeepAlive in interface HttpServerResponsepublic 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 paramspublic 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 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 headerspublic Mono<Void> sendWebsocket(@Nullable String protocols, int maxFramePayloadLength, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> websocketHandler)
HttpServerResponseMono fails.sendWebsocket in interface HttpServerResponseprotocols - optional sub-protocolmaxFramePayloadLength - maximum allowable frame payload lengthwebsocketHandler - the in/out handler for ws transportMono completing when upgrade is confirmedpublic String uri()
HttpInfospublic HttpVersion version()
HttpInfospublic HttpServerResponse compression(boolean compress)
HttpServerResponsecompression in interface HttpServerResponsecompress - should handle compressionprotected void preSendHeadersAndStatus()
preSendHeadersAndStatus in class HttpOperations<HttpServerRequest,HttpServerResponse>protected void onOutboundComplete()
ChannelOperationsonOutboundComplete in class ChannelOperations<HttpServerRequest,HttpServerResponse>protected void onOutboundError(Throwable err)
ChannelOperationsonOutboundError in class ChannelOperations<HttpServerRequest,HttpServerResponse>err - the Throwable causeprotected HttpMessage outboundHttpMessage()
HttpOperationsoutboundHttpMessage in class HttpOperations<HttpServerRequest,HttpServerResponse>