@Contract(threading=IMMUTABLE) public class StrictContentLengthStrategy extends Object implements ContentLengthStrategy
ProtocolException if it encounters an unsupported
transfer encoding or a malformed Content-Length header
value.
This class recognizes "chunked" and "identitiy" transfer-coding only.
| Modifier and Type | Field and Description |
|---|---|
static StrictContentLengthStrategy |
INSTANCE |
CHUNKED, IDENTITY| Constructor and Description |
|---|
StrictContentLengthStrategy()
Creates
StrictContentLengthStrategy instance. |
StrictContentLengthStrategy(int implicitLen)
Creates
StrictContentLengthStrategy instance with the given length used per default
when content length is not explicitly specified in the message. |
public static final StrictContentLengthStrategy INSTANCE
public StrictContentLengthStrategy(int implicitLen)
StrictContentLengthStrategy instance with the given length used per default
when content length is not explicitly specified in the message.implicitLen - implicit content length.public StrictContentLengthStrategy()
StrictContentLengthStrategy instance. ContentLengthStrategy.IDENTITY
is used per default when content length is not explicitly specified in the message.public long determineLength(HttpMessage message) throws HttpException
ContentLengthStrategyContentLengthStrategy.IDENTITY if the end of the
message will be delimited by the end of connection, or ContentLengthStrategy.CHUNKED
if the message is chunk codeddetermineLength in interface ContentLengthStrategymessage - HTTP messageContentLengthStrategy.IDENTITY, or ContentLengthStrategy.CHUNKEDHttpException - in case of HTTP protocol violationCopyright © 2005–2022 The Apache Software Foundation. All rights reserved.