@Contract(threading=IMMUTABLE) public class DefaultContentLengthStrategy extends Object implements ContentLengthStrategy
ProtocolException if it encounters an unsupported
transfer encoding, multiple Content-Length header
values or a malformed Content-Length header value.
This class recognizes "chunked" transfer-coding only.
| Modifier and Type | Field and Description |
|---|---|
static DefaultContentLengthStrategy |
INSTANCE |
CHUNKED, UNDEFINED| Constructor and Description |
|---|
DefaultContentLengthStrategy()
Creates
DefaultContentLengthStrategy instance. |
| Modifier and Type | Method and Description |
|---|---|
long |
determineLength(HttpMessage message)
Returns length of the given message in bytes.
|
public static final DefaultContentLengthStrategy INSTANCE
public DefaultContentLengthStrategy()
DefaultContentLengthStrategy instance. ContentLengthStrategy.UNDEFINED
is used per default when content length is not explicitly specified in the message.public long determineLength(HttpMessage message) throws HttpException
ContentLengthStrategyContentLengthStrategy.CHUNKED if the message is
chunk coded, or ContentLengthStrategy.UNDEFINED if the message is not explicitly
delineated.determineLength in interface ContentLengthStrategymessage - HTTP messageContentLengthStrategy.UNDEFINED, or ContentLengthStrategy.CHUNKEDHttpException - in case of HTTP protocol violationCopyright © 2005–2021 The Apache Software Foundation. All rights reserved.