Package reactor.netty.http
Class HttpOperations<INBOUND extends NettyInbound,OUTBOUND extends NettyOutbound>
java.lang.Object
reactor.netty.channel.ChannelOperations<INBOUND,OUTBOUND>
reactor.netty.http.HttpOperations<INBOUND,OUTBOUND>
- All Implemented Interfaces:
Publisher<Void>,Subscriber<Void>,CoreSubscriber<Void>,Disposable,ChannelOperationsId,Connection,DisposableChannel,HttpInfos,NettyInbound,NettyOutbound
public abstract class HttpOperations<INBOUND extends NettyInbound,OUTBOUND extends NettyOutbound>
extends ChannelOperations<INBOUND,OUTBOUND>
implements HttpInfos
An HTTP ready
ChannelOperations with state management for status and headers
(first HTTP response packet).- Author:
- Stephane Maldini
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classNested classes/interfaces inherited from class reactor.netty.channel.ChannelOperations
ChannelOperations.OnSetupNested classes/interfaces inherited from interface reactor.core.Disposable
Disposable.Composite, Disposable.Swap -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHttpOperations(Connection connection, ConnectionObserver listener, HttpOperations<INBOUND, OUTBOUND> replaced) protectedHttpOperations(Connection connection, ConnectionObserver listener, HttpMessageLogFactory httpMessageLogFactory) protectedHttpOperations(HttpOperations<INBOUND, OUTBOUND> replaced) -
Method Summary
Modifier and TypeMethodDescriptionaddHandler(String name, ChannelHandler handler) protected abstract voidprotected Stringprotected abstract voidprotected final booleanHas Body been sent.final booleanHas headers been sent.protected HttpMessageLogFactoryprotected final Stringprotected abstract booleanbooleanReturns true if websocket connection (upgraded).protected final booleanMark the body sent.protected final booleanmarkSentHeaderAndBody(Object... objectsToRelease) Mark the headers and body sent.protected final booleanmarkSentHeaders(Object... objectsToRelease) Mark the headers sent.protected abstract HttpMessagenewFullBodyMessage(ByteBuf body) protected abstract voidprotected abstract HttpMessageOutbound Netty HttpMessage.protected HttpMessageprepareHttpMessage(ByteBuf buffer) Return a unique id for the request.static StringresolvePath(String uri) Returns the decoded path portion from the provideduri.final NettyOutboundsendObject(Object message) then()toString()Methods inherited from class reactor.netty.channel.ChannelOperations
addMetricsHandler, addReactiveBridge, afterInboundComplete, alloc, as, asLongText, asShortText, channel, connection, currentContext, discard, discardWhenNoReceiver, dispose, disposeSubscriber, formatName, get, inbound, isDisposed, isInboundCancelled, isInboundComplete, isInboundDisposed, isPersistent, isSubscriptionDisposed, listener, onComplete, onDispose, onDispose, onError, onInboundCancel, onInboundClose, onInboundComplete, onInboundError, onInboundNext, onNext, onOutboundComplete, onOutboundError, onSubscribe, onTerminate, onUnprocessedOutboundError, onWritabilityChanged, outbound, receive, receiveObject, send, sendObject, sendUsing, terminate, withConnection, wrapInboundErrorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface reactor.netty.Connection
addHandler, addHandlerFirst, addHandlerFirst, addHandlerLast, addHandlerLast, bind, markPersistent, onReadIdle, onWriteIdle, rebind, removeHandler, replaceHandlerMethods inherited from interface reactor.netty.DisposableChannel
address, disposeNow, disposeNowMethods inherited from interface reactor.netty.http.HttpInfos
cookies, fullPath, isKeepAlive, method, path, uri, versionMethods inherited from interface reactor.netty.NettyOutbound
neverComplete, sendByteArray, sendFile, sendFileChunked, sendGroups, sendObject, sendString, sendString, subscribe, then, then
-
Constructor Details
-
HttpOperations
-
HttpOperations
protected HttpOperations(Connection connection, ConnectionObserver listener, HttpOperations<INBOUND, OUTBOUND> replaced) -
HttpOperations
protected HttpOperations(Connection connection, ConnectionObserver listener, HttpMessageLogFactory httpMessageLogFactory)
-
-
Method Details
-
hasSentHeaders
public final boolean hasSentHeaders()Has headers been sent.- Returns:
- true if headers have been sent
-
isWebsocket
public boolean isWebsocket()Description copied from interface:HttpInfosReturns true if websocket connection (upgraded).- Specified by:
isWebsocketin interfaceHttpInfos- Returns:
- true if websocket connection
-
requestId
Description copied from interface:HttpInfosReturn a unique id for the request. The id is a combination of the id of the underlying connection and the serial number of the request received on that connection.Format of the id:
<CONNECTION_ID>-<REQUEST_NUMBER>Example:
<CONNECTION_ID>: 329c6ffd <REQUEST_NUMBER>: 5 Result: 329c6ffd-5 -
send
- Specified by:
sendin interfaceNettyOutbound
-
sendObject
- Specified by:
sendObjectin interfaceNettyOutbound- Overrides:
sendObjectin classChannelOperations<INBOUND extends NettyInbound,OUTBOUND extends NettyOutbound>
-
then
- Specified by:
thenin interfaceNettyOutbound
-
asDebugLogMessage
- Overrides:
asDebugLogMessagein classChannelOperations<INBOUND extends NettyInbound,OUTBOUND extends NettyOutbound>
-
httpMessageLogFactory
-
beforeMarkSentHeaders
protected abstract void beforeMarkSentHeaders() -
afterMarkSentHeaders
protected abstract void afterMarkSentHeaders() -
isContentAlwaysEmpty
protected abstract boolean isContentAlwaysEmpty() -
onHeadersSent
protected abstract void onHeadersSent() -
newFullBodyMessage
-
sendFile
- Specified by:
sendFilein interfaceNettyOutbound
-
toString
- Overrides:
toStringin classChannelOperations<INBOUND extends NettyInbound,OUTBOUND extends NettyOutbound>
-
addHandler
- Specified by:
addHandlerin interfaceConnection
-
markSentHeaders
Mark the headers sent.- Returns:
- true if marked for the first time
-
markSentBody
protected final boolean markSentBody()Mark the body sent.- Returns:
- true if marked for the first time
-
hasSentBody
protected final boolean hasSentBody()Has Body been sent.- Returns:
- true if body has been sent
- Since:
- 1.0.37
-
markSentHeaderAndBody
Mark the headers and body sent.- Returns:
- true if marked for the first time
-
initShortId
- Overrides:
initShortIdin classChannelOperations<INBOUND extends NettyInbound,OUTBOUND extends NettyOutbound>
-
resolvePath
Returns the decoded path portion from the provideduri.- Parameters:
uri- an HTTP URL that may contain a path with query/fragment- Returns:
- the decoded path portion from the provided
uri
-
outboundHttpMessage
Outbound Netty HttpMessage.- Returns:
- Outbound Netty HttpMessage
-
prepareHttpMessage
-