Top Description Fields Methods
org.apache.hc.core5.http

public Interface ContentLengthStrategy

Known Direct Implementers
org.apache.hc.core5.http.impl.DefaultContentLengthStrategy
Annotations
@Contract
threading:STATELESS
Imports
org.apache.hc.core5.annotation.Contract, .ThreadingBehavior

Represents a strategy to determine length of the enclosed content entity based on properties of the HTTP message.
Since
4.0

Field Summary

Modifier and TypeField and Description
public static final long
CHUNKED

Message body chunk coded

public static final long
UNDEFINED

Message body not explicitly delineated.

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

content length, UNDEFINED, or CHUNKED
determineLength
(HttpMessage
HTTP message
message
)

Returns length of the given message in bytes.

Field Detail

CHUNKEDback to summary
public static final long CHUNKED

Message body chunk coded

UNDEFINEDback to summary
public static final long UNDEFINED

Message body not explicitly delineated. Legal for HTTP response messages and illegal for HTTP request messages.

Method Detail

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

Returns length of the given message in bytes. The returned value must be a non-negative number, CHUNKED if the message is chunk coded, or UNDEFINED if the message is not explicitly delineated.

Parameters
message:HttpMessage

HTTP message

Returns:long

content length, UNDEFINED, or CHUNKED

Exceptions
HttpException:
in case of HTTP protocol violation