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
  • Constructor Details

  • 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: HttpInfos
      Returns true if websocket connection (upgraded).
      Specified by:
      isWebsocket in interface HttpInfos
      Returns:
      true if websocket connection
    • requestId

      public String requestId()
      Description copied from interface: HttpInfos
      Return 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

      Specified by:
      requestId in interface HttpInfos
      Returns:
      an unique id for the request
    • send

      public NettyOutbound send(Publisher<? extends ByteBuf> source)
      Specified by:
      send in interface NettyOutbound
    • sendObject

      public NettyOutbound sendObject(Object message)
      Specified by:
      sendObject in interface NettyOutbound
      Overrides:
      sendObject in class ChannelOperations<INBOUND extends NettyInbound,OUTBOUND extends NettyOutbound>
    • then

      public Mono<Void> then()
      Specified by:
      then in interface NettyOutbound
    • asDebugLogMessage

      protected String asDebugLogMessage(Object o)
      Overrides:
      asDebugLogMessage in class ChannelOperations<INBOUND extends NettyInbound,OUTBOUND extends NettyOutbound>
    • httpMessageLogFactory

      protected HttpMessageLogFactory httpMessageLogFactory()
    • beforeMarkSentHeaders

      protected abstract void beforeMarkSentHeaders()
    • afterMarkSentHeaders

      protected abstract void afterMarkSentHeaders()
    • isContentAlwaysEmpty

      protected abstract boolean isContentAlwaysEmpty()
    • onHeadersSent

      protected abstract void onHeadersSent()
    • newFullBodyMessage

      protected abstract HttpMessage newFullBodyMessage(ByteBuf body)
    • sendFile

      public final NettyOutbound sendFile(Path file, long position, long count)
      Specified by:
      sendFile in interface NettyOutbound
    • toString

      public String toString()
      Overrides:
      toString in class ChannelOperations<INBOUND extends NettyInbound,OUTBOUND extends NettyOutbound>
    • addHandler

      public HttpOperations<INBOUND,OUTBOUND> addHandler(String name, ChannelHandler handler)
      Specified by:
      addHandler in interface Connection
    • markSentHeaders

      protected final boolean markSentHeaders(Object... objectsToRelease)
      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

      protected final boolean markSentHeaderAndBody(Object... objectsToRelease)
      Mark the headers and body sent.
      Returns:
      true if marked for the first time
    • initShortId

      protected final String initShortId()
      Overrides:
      initShortId in class ChannelOperations<INBOUND extends NettyInbound,OUTBOUND extends NettyOutbound>
    • resolvePath

      public static String resolvePath(String uri)
      Returns the decoded path portion from the provided uri.
      Parameters:
      uri - an HTTP URL that may contain a path with query/fragment
      Returns:
      the decoded path portion from the provided uri
    • outboundHttpMessage

      protected abstract HttpMessage outboundHttpMessage()
      Outbound Netty HttpMessage.
      Returns:
      Outbound Netty HttpMessage
    • prepareHttpMessage

      protected HttpMessage prepareHttpMessage(ByteBuf buffer)