Top Description Fields Constructors Methods
org.apache.http.impl.entity

public Class LaxContentLengthStrategy

extends Object
implements ContentLengthStrategy
Class Inheritance
All Implemented Interfaces
org.apache.http.entity.ContentLengthStrategy
Annotations
@Contract
threading:IMMUTABLE
Imports
org.apache.http.Header, .HeaderElement, .HttpException, .HttpMessage, .ParseException, .ProtocolException, org.apache.http.annotation.ThreadingBehavior, .Contract, org.apache.http.entity.ContentLengthStrategy, org.apache.http.protocol.HTTP, org.apache.http.util.Args

The lax implementation of the content length strategy. This class will ignore unrecognized transfer encodings and malformed Content-Length header values.

This class recognizes "chunked" and "identitiy" transfer-coding only.

Since
4.0

Field Summary

Modifier and TypeField and Description
private final int
public static final LaxContentLengthStrategy

Constructor Summary

AccessConstructor and Description
public
LaxContentLengthStrategy(final int
implicit content length.
implicitLen
)

Creates LaxContentLengthStrategy instance with the given length used per default when content length is not explicitly specified in the message.

public
LaxContentLengthStrategy()

Creates LaxContentLengthStrategy instance.

Method Summary

Modifier and TypeMethod and Description
public long
determineLength(final HttpMessage
HTTP message
message
)

Implements org.apache.http.entity.ContentLengthStrategy.determineLength.

Returns length of the given message in bytes.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

implicitLenback to summary
private final int implicitLen
INSTANCEback to summary
public static final LaxContentLengthStrategy INSTANCE

Constructor Detail

LaxContentLengthStrategyback to summary
public LaxContentLengthStrategy(final int implicitLen)

Creates LaxContentLengthStrategy instance with the given length used per default when content length is not explicitly specified in the message.

Parameters
implicitLen:int

implicit content length.

Since
4.2
LaxContentLengthStrategyback to summary
public LaxContentLengthStrategy()

Creates LaxContentLengthStrategy instance. ContentLengthStrategy#IDENTITY is used per default when content length is not explicitly specified in the message.

Method Detail

determineLengthback to summary
public long determineLength(final HttpMessage message) throws HttpException

Implements org.apache.http.entity.ContentLengthStrategy.determineLength.

Doc from org.apache.http.entity.ContentLengthStrategy.determineLength.

Returns length of the given message in bytes. The returned value must be a non-negative number, IDENTITY if the end of the message will be delimited by the end of connection, or CHUNKED if the message is chunk coded

Parameters
message:HttpMessage

HTTP message

Returns:long

content length, IDENTITY, or CHUNKED

Annotations
@Override
Exceptions
HttpException:
in case of HTTP protocol violation