@Contract(threading=IMMUTABLE) public class LaxContentLengthStrategy extends Object implements ContentLengthStrategy
Content-Length
header values.
This class recognizes "chunked" and "identitiy" transfer-coding only.
Modifier and Type | Field and Description |
---|---|
private int |
implicitLen |
static LaxContentLengthStrategy |
INSTANCE |
CHUNKED, IDENTITY
Constructor and Description |
---|
LaxContentLengthStrategy()
Creates
LaxContentLengthStrategy instance. |
LaxContentLengthStrategy(int implicitLen)
Creates
LaxContentLengthStrategy instance with the given length used per default
when content length is not explicitly specified in the message. |
Modifier and Type | Method and Description |
---|---|
long |
determineLength(HttpMessage message)
Returns length of the given message in bytes.
|
public static final LaxContentLengthStrategy INSTANCE
private final int implicitLen
public LaxContentLengthStrategy(int implicitLen)
LaxContentLengthStrategy
instance with the given length used per default
when content length is not explicitly specified in the message.implicitLen
- implicit content length.public LaxContentLengthStrategy()
LaxContentLengthStrategy
instance. ContentLengthStrategy.IDENTITY
is used per default when content length is not explicitly specified in the message.public long determineLength(HttpMessage message) throws HttpException
ContentLengthStrategy
ContentLengthStrategy.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 ContentLengthStrategy
message
- HTTP messageContentLengthStrategy.IDENTITY
, or ContentLengthStrategy.CHUNKED
HttpException
- in case of HTTP protocol violationWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses