Module org.glassfish.grizzly.http
Package org.glassfish.grizzly.http
Class FixedLengthTransferEncoding
java.lang.Object
org.glassfish.grizzly.http.FixedLengthTransferEncoding
- All Implemented Interfaces:
TransferEncoding
Fixed length transfer encoding implementation.
- Author:
- Alexey Stashok
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionparsePacket
(org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpHeader httpPacket, org.glassfish.grizzly.Buffer input) Parse HTTP packet payload, represented byBuffer
using specific transfer encoding.void
prepareSerialize
(org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpHeader httpHeader, HttpContent httpContent) This method will be called byHttpCodecFilter
to let TransferEncoding prepare itself for the content serialization.org.glassfish.grizzly.Buffer
serializePacket
(org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpContent httpContent) Serialize HTTP packet payload, represented byHttpContent
using specific transfer encoding.boolean
wantDecode
(HttpHeader httpPacket) Return true if this encoding should be used to parse the content of the passedHttpHeader
, or false otherwise.boolean
wantEncode
(HttpHeader httpPacket) Return true if this encoding should be used to serialize the content of the passedHttpHeader
, or false otherwise.
-
Constructor Details
-
FixedLengthTransferEncoding
public FixedLengthTransferEncoding()
-
-
Method Details
-
wantDecode
Return true if this encoding should be used to parse the content of the passedHttpHeader
, or false otherwise.- Specified by:
wantDecode
in interfaceTransferEncoding
- Parameters:
httpPacket
-HttpHeader
.- Returns:
- true if this encoding should be used to parse the content of the passed
HttpHeader
, or false otherwise.
-
wantEncode
Return true if this encoding should be used to serialize the content of the passedHttpHeader
, or false otherwise.- Specified by:
wantEncode
in interfaceTransferEncoding
- Parameters:
httpPacket
-HttpHeader
.- Returns:
- true if this encoding should be used to serialize the content of the passed
HttpHeader
, or false otherwise.
-
prepareSerialize
public void prepareSerialize(org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpHeader httpHeader, HttpContent httpContent) Description copied from interface:TransferEncoding
This method will be called byHttpCodecFilter
to let TransferEncoding prepare itself for the content serialization. At this time TransferEncoding is able to change, update HTTP packet headers.- Specified by:
prepareSerialize
in interfaceTransferEncoding
- Parameters:
ctx
-FilterChainContext
httpHeader
- HTTP packet headers.httpContent
- ready HTTP content (might be null).
-
parsePacket
public ParsingResult parsePacket(org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpHeader httpPacket, org.glassfish.grizzly.Buffer input) Parse HTTP packet payload, represented byBuffer
using specific transfer encoding.- Specified by:
parsePacket
in interfaceTransferEncoding
- Parameters:
ctx
-FilterChainContext
httpPacket
-HttpHeader
with parsed headers.input
-Buffer
HTTP message payload.- Returns:
ParsingResult
-
serializePacket
public org.glassfish.grizzly.Buffer serializePacket(org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpContent httpContent) Serialize HTTP packet payload, represented byHttpContent
using specific transfer encoding.- Specified by:
serializePacket
in interfaceTransferEncoding
- Parameters:
ctx
-FilterChainContext
httpContent
-HttpContent
with parsedHttpContent.getHttpHeader()
.- Returns:
- serialized
Buffer
-