public abstract class HttpOperations<INBOUND extends NettyInbound,OUTBOUND extends NettyOutbound> extends ChannelOperations<INBOUND,OUTBOUND> implements HttpInfos
ChannelOperations with state management for status and headers
(first HTTP response packet).ChannelOperations.OnSetupDisposable.Composite, Disposable.Swap| Modifier | Constructor and Description |
|---|---|
protected |
HttpOperations(Connection connection,
ConnectionObserver listener) |
protected |
HttpOperations(HttpOperations<INBOUND,OUTBOUND> replaced) |
| Modifier and Type | Method and Description |
|---|---|
HttpOperations<INBOUND,OUTBOUND> |
addHandler(String name,
ChannelHandler handler)
Add a
ChannelHandler with Connection.addHandlerFirst(io.netty.channel.ChannelHandler) if of type of
ChannelOutboundHandler otherwise with
Connection.addHandlerLast(io.netty.channel.ChannelHandler). |
boolean |
hasSentHeaders()
Has headers been sent
|
protected boolean |
isKeepAlive(HttpMessage message) |
boolean |
isWebsocket()
Returns true if websocket connection (upgraded)
|
protected boolean |
markSentBody()
Mark the body sent
|
protected boolean |
markSentHeaderAndBody()
Mark the headers and body sent
|
protected boolean |
markSentHeaders()
Mark the headers sent
|
protected abstract HttpMessage |
newFullEmptyBodyMessage() |
protected abstract HttpMessage |
outboundHttpMessage()
Outbound Netty HttpMessage
|
protected abstract void |
preSendHeadersAndStatus() |
NettyOutbound |
sendFile(Path file,
long position,
long count)
Sends content from the given
Path using
FileChannel.transferTo(long, long, WritableByteChannel)
support, if the system supports it, the path resolves to a local file
system File, compression and SSL/TLS is not enabled, then transfer will
use zero-byte copy to the peer., otherwise chunked read/write will be used. |
Mono<Void> |
then()
Obtains a
Mono of pending outbound(s) write completion. |
String |
toString() |
addListener, 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, onInboundNext, onNext, onOutboundComplete, onOutboundError, onSubscribe, onTerminate, outbound, receive, receiveObject, removeListener, removeListeners, sendObject, sendObject, sendUsing, setFailure, setSuccess, setSuccess, sync, syncUninterruptibly, terminate, tryFailure, trySuccess, unvoid, withConnectionawait, await, awaitUninterruptibly, awaitUninterruptibly, cancel, cause, checkDeadLock, executor, getNow, isCancellable, isCancelled, isDone, isSuccess, notifyListener, setUncancellable, toStringBuilder, trySuccessget, getclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcookies, isKeepAlive, method, path, uri, versionneverComplete, options, send, sendByteArray, sendFile, sendFileChunked, sendGroups, sendString, sendString, subscribe, thenaddHandler, addHandlerFirst, addHandlerFirst, addHandlerLast, addHandlerLast, bind, from, markPersistent, onReadIdle, onWriteIdle, rebind, removeHandler, replaceHandleraddress, disposeNow, disposeNowsetUncancellable, trySuccessawait, await, awaitUninterruptibly, awaitUninterruptibly, cancel, cause, getNow, isCancellable, isSuccessget, get, isCancelled, isDoneprotected HttpOperations(HttpOperations<INBOUND,OUTBOUND> replaced)
protected HttpOperations(Connection connection, ConnectionObserver listener)
public final boolean hasSentHeaders()
public boolean isWebsocket()
HttpInfosisWebsocket in interface HttpInfospublic Mono<Void> then()
NettyOutboundMono of pending outbound(s) write completion.then in interface NettyOutboundMono of pending outbound(s) write completionprotected abstract void preSendHeadersAndStatus()
protected abstract HttpMessage newFullEmptyBodyMessage()
public final NettyOutbound sendFile(Path file, long position, long count)
NettyOutboundPath using
FileChannel.transferTo(long, long, WritableByteChannel)
support, if the system supports it, the path resolves to a local file
system File, compression and SSL/TLS is not enabled, then transfer will
use zero-byte copy to the peer., otherwise chunked read/write will be used.
It will listens for any error on write and closes on terminal signal (complete|error). If more than one publisher is attached (multiple calls to send()) completion occurs after all publishers complete.
Note: Nesting any send* method is not supported.sendFile in interface NettyOutboundfile - the file Pathposition - where to startcount - how much to transferpublic String toString()
toString in class ChannelOperations<INBOUND extends NettyInbound,OUTBOUND extends NettyOutbound>public HttpOperations<INBOUND,OUTBOUND> addHandler(String name, ChannelHandler handler)
ConnectionChannelHandler with Connection.addHandlerFirst(io.netty.channel.ChannelHandler) if of type of
ChannelOutboundHandler otherwise with
Connection.addHandlerLast(io.netty.channel.ChannelHandler). Implementation may add more auto handling in particular
HTTP based context will prepend an HttpContent body extractor.
[ [reactor codecs], [<- user FIRST HANDLERS added here, user LAST HANDLERS added here ->], [reactor handlers] ]
If effectively added, the handler will be safely removed when the channel is made inactive (pool release).
addHandler in interface Connectionname - handler namehandler - handler instanceprotected final boolean markSentHeaders()
protected final boolean markSentBody()
protected final boolean markSentHeaderAndBody()
protected boolean isKeepAlive(HttpMessage message)
protected abstract HttpMessage outboundHttpMessage()