Class HttpTunnelPayload
java.lang.Object
org.springframework.boot.devtools.tunnel.payload.HttpTunnelPayload
Encapsulates a payload data sent via a HTTP tunnel.
- Since:
- 1.3.0
- Author:
- Phillip Webb
-
Field Summary
-
Constructor Summary
ConstructorDescriptionHttpTunnelPayload
(long sequence, ByteBuffer data) Create a newHttpTunnelPayload
instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
assignTo
(HttpOutputMessage message) Assign this payload to the givenHttpOutputMessage
.static HttpTunnelPayload
get
(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
Return the sequence number of the payload.void
Log incoming payload information at trace level to aid diagnostics.void
Log incoming payload information at trace level to aid diagnostics.Return the payload as a hexadecimal string.void
writeTo
(WritableByteChannel channel) Write the content of this payload to the given target channel.
-
Field Details
-
HEX_CHARS
protected static final char[] HEX_CHARS
-
-
Constructor Details
-
HttpTunnelPayload
Create a newHttpTunnelPayload
instance.- Parameters:
sequence
- the sequence number of the payloaddata
- the payload data
-
-
Method Details
-
getSequence
public long getSequence()Return the sequence number of the payload.- Returns:
- the sequence
-
assignTo
Assign this payload to the givenHttpOutputMessage
.- Parameters:
message
- the message to assign this payload to- Throws:
IOException
- in case of I/O errors
-
writeTo
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
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
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
Return the payload as a hexadecimal string.- Returns:
- the payload as a hex string
-