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
Field Summary
Fields Modifier and Type Field Description protected static char[]HEX_CHARS
Constructor Summary
Constructors Constructor Description HttpTunnelPayload(long sequence, ByteBuffer data)Create a newHttpTunnelPayloadinstance.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassignTo(org.springframework.http.HttpOutputMessage message)Assign this payload to the givenHttpOutputMessage.static HttpTunnelPayloadget(org.springframework.http.HttpInputMessage message)Return theHttpTunnelPayloadfor the given message ornullif there is no payload.static ByteBuffergetPayloadData(ReadableByteChannel channel)Return the payload data for the given sourceReadableByteChannelor null if the channel timed out whilst reading.longgetSequence()Return the sequence number of the payload.voidlogIncoming()Log incoming payload information at trace level to aid diagnostics.voidlogOutgoing()Log incoming payload information at trace level to aid diagnostics.StringtoHexString()Return the payload as a hexadecimal string.voidwriteTo(WritableByteChannel channel)Write the content of this payload to the given target channel.
Field Detail
HEX_CHARS
protected static final char[] HEX_CHARS
Constructor Detail
HttpTunnelPayload
public HttpTunnelPayload(long sequence, ByteBuffer data)
Create a newHttpTunnelPayloadinstance.- Parameters:
sequence- the sequence number of the payloaddata- the payload data
Method Detail
getSequence
public long getSequence()
Return the sequence number of the payload.- Returns:
- the sequence
assignTo
public void assignTo(org.springframework.http.HttpOutputMessage message) throws IOException
Assign this payload to the givenHttpOutputMessage.- 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(org.springframework.http.HttpInputMessage message) throws IOException
Return theHttpTunnelPayloadfor the given message ornullif 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 sourceReadableByteChannelor 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