Package org.glassfish.grizzly.http
Interface TransferEncoding
-
- All Known Implementing Classes:
ChunkedTransferEncoding,FixedLengthTransferEncoding
public interface TransferEncodingAbstraction, which represents HTTP transfer-encoding. The implementation should take care about possible HTTP content fragmentation.- Author:
- Alexey Stashok
- See Also:
FixedLengthTransferEncoding,ChunkedTransferEncoding
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ParsingResultparsePacket(org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpHeader httpPacket, org.glassfish.grizzly.Buffer buffer)Parse HTTP packet payload, represented byBufferusing specific transfer encoding.voidprepareSerialize(org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpHeader httpHeader, HttpContent content)This method will be called byHttpCodecFilterto let TransferEncoding prepare itself for the content serialization.org.glassfish.grizzly.BufferserializePacket(org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpContent httpContent)Serialize HTTP packet payload, represented byHttpContentusing specific transfer encoding.booleanwantDecode(HttpHeader httpPacket)Return true if this encoding should be used to parse the content of the passedHttpHeader, or false otherwise.booleanwantEncode(HttpHeader httpPacket)Return true if this encoding should be used to serialize the content of the passedHttpHeader, or false otherwise.
-
-
-
Method Detail
-
wantDecode
boolean wantDecode(HttpHeader httpPacket)
Return true if this encoding should be used to parse the content of the passedHttpHeader, or false otherwise.- Parameters:
httpPacket-HttpHeader.- Returns:
- true if this encoding should be used to parse the content of the passed
HttpHeader, or false otherwise.
-
wantEncode
boolean wantEncode(HttpHeader httpPacket)
Return true if this encoding should be used to serialize the content of the passedHttpHeader, or false otherwise.- Parameters:
httpPacket-HttpHeader.- Returns:
- true if this encoding should be used to serialize the content of the passed
HttpHeader, or false otherwise.
-
prepareSerialize
void prepareSerialize(org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpHeader httpHeader, HttpContent content)This method will be called byHttpCodecFilterto let TransferEncoding prepare itself for the content serialization. At this time TransferEncoding is able to change, update HTTP packet headers.- Parameters:
ctx-FilterChainContexthttpHeader- HTTP packet headers.content- ready HTTP content (might be null).
-
parsePacket
ParsingResult parsePacket(org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpHeader httpPacket, org.glassfish.grizzly.Buffer buffer)
Parse HTTP packet payload, represented byBufferusing specific transfer encoding.- Parameters:
ctx-FilterChainContexthttpPacket-HttpHeaderwith parsed headers.buffer-BufferHTTP message payload.- Returns:
ParsingResult
-
serializePacket
org.glassfish.grizzly.Buffer serializePacket(org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpContent httpContent)Serialize HTTP packet payload, represented byHttpContentusing specific transfer encoding.- Parameters:
ctx-FilterChainContexthttpContent-HttpContentwith parsedHttpContent.getHttpHeader().- Returns:
- serialized
Buffer
-
-