Class HttpTunnelPayload

java.lang.Object
org.springframework.boot.devtools.tunnel.payload.HttpTunnelPayload

public class HttpTunnelPayload extends Object
Encapsulates a payload data sent via a HTTP tunnel.
Since:
1.3.0
Author:
Phillip Webb
  • Field Details

    • HEX_CHARS

      protected static final char[] HEX_CHARS
  • Constructor Details

    • HttpTunnelPayload

      public HttpTunnelPayload(long sequence, ByteBuffer data)
      Create a new HttpTunnelPayload instance.
      Parameters:
      sequence - the sequence number of the payload
      data - the payload data
  • Method Details

    • getSequence

      public long getSequence()
      Return the sequence number of the payload.
      Returns:
      the sequence
    • assignTo

      public void assignTo(HttpOutputMessage message) throws IOException
      Assign this payload to the given HttpOutputMessage.
      Parameters:
      message - the message to assign this payload to
      Throws:
      IOException - in case of I/O errors
    • writeTo

      public void writeTo(WritableByteChannel channel) throws IOException
      Write the content of this payload to the given target channel.
      Parameters:
      channel - the channel to write to
      Throws:
      IOException - in case of I/O errors
    • get

      public static HttpTunnelPayload get(HttpInputMessage message) throws IOException
      Return the HttpTunnelPayload for the given message or null if there is no payload.
      Parameters:
      message - the HTTP message
      Returns:
      the payload or null
      Throws:
      IOException - in case of I/O errors
    • getPayloadData

      public static ByteBuffer getPayloadData(ReadableByteChannel channel) throws IOException
      Return the payload data for the given source ReadableByteChannel or null if the channel timed out whilst reading.
      Parameters:
      channel - the source channel
      Returns:
      payload data or null
      Throws:
      IOException - in case of I/O errors
    • logIncoming

      public void logIncoming()
      Log incoming payload information at trace level to aid diagnostics.
    • logOutgoing

      public void logOutgoing()
      Log incoming payload information at trace level to aid diagnostics.
    • toHexString

      public String toHexString()
      Return the payload as a hexadecimal string.
      Returns:
      the payload as a hex string