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 newHttpTunnelPayload
instance.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assignTo(org.springframework.http.HttpOutputMessage message)
Assign this payload to the givenHttpOutputMessage
.static HttpTunnelPayload
get(org.springframework.http.HttpInputMessage message)
Return theHttpTunnelPayload
for the given message ornull
if there is no payload.static ByteBuffer
getPayloadData(ReadableByteChannel channel)
Return the payload data for the given sourceReadableByteChannel
or null if the channel timed out whilst reading.long
getSequence()
Return the sequence number of the payload.void
logIncoming()
Log incoming payload information at trace level to aid diagnostics.void
logOutgoing()
Log incoming payload information at trace level to aid diagnostics.String
toHexString()
Return the payload as a hexadecimal string.void
writeTo(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 newHttpTunnelPayload
instance.- 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 theHttpTunnelPayload
for the given message ornull
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 sourceReadableByteChannel
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