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.OnSetup
Disposable.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
|
boolean |
isWebsocket()
Return 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)
Send content from given
Path using
FileChannel.transferTo(long, long, WritableByteChannel)
support. |
Mono<Void> |
then()
Obtain 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, trySuccess, unvoid, withConnection
await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, cause, checkDeadLock, executor, getNow, isCancellable, isCancelled, isDone, isSuccess, notifyListener, setUncancellable, toStringBuilder, tryFailure, trySuccess
get, get
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
cookies, isKeepAlive, method, path, uri, version
neverComplete, options, send, sendByteArray, sendFile, sendFileChunked, sendGroups, sendString, sendString, subscribe, then
addHandler, addHandlerFirst, addHandlerFirst, addHandlerLast, addHandlerLast, bind, from, markPersistent, onReadIdle, onWriteIdle, rebind, removeHandler, replaceHandler
address, disposeNow, disposeNow
setUncancellable, tryFailure, trySuccess
await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, cause, getNow, isCancellable, isSuccess
get, get, isCancelled, isDone
protected HttpOperations(HttpOperations<INBOUND,OUTBOUND> replaced)
protected HttpOperations(Connection connection, ConnectionObserver listener)
public final boolean hasSentHeaders()
public boolean isWebsocket()
HttpInfos
isWebsocket
in interface HttpInfos
public Mono<Void> then()
NettyOutbound
Mono
of pending outbound(s) write completion.then
in interface NettyOutbound
Mono
of pending outbound(s) write completionprotected abstract void preSendHeadersAndStatus()
protected abstract HttpMessage newFullEmptyBodyMessage()
public final NettyOutbound sendFile(Path file, long position, long count)
NettyOutbound
Path
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 NettyOutbound
file
- 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)
Connection
ChannelHandler
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 Connection
name
- handler namehandler
- handler instanceprotected final boolean markSentHeaders()
protected final boolean markSentBody()
protected final boolean markSentHeaderAndBody()
protected abstract HttpMessage outboundHttpMessage()