Package org.apache.hc.core5.http
Interface ContentLengthStrategy
-
- All Known Implementing Classes:
DefaultContentLengthStrategy
@Contract(threading=STATELESS) public interface ContentLengthStrategy
Represents a strategy to determine length of the enclosed content entity based on properties of the HTTP message.- Since:
- 4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
determineLength(HttpMessage message)
Returns length of the given message in bytes.
-
-
-
Field Detail
-
CHUNKED
static final long CHUNKED
Message body chunk coded- See Also:
- Constant Field Values
-
UNDEFINED
static final long UNDEFINED
Message body not explicitly delineated. Legal for HTTP response messages and illegal for HTTP request messages.- See Also:
- Constant Field Values
-
-
Method Detail
-
determineLength
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, orUNDEFINED
if the message is not explicitly delineated.- Parameters:
message
- HTTP message- Returns:
- content length,
UNDEFINED
, orCHUNKED
- Throws:
HttpException
- in case of HTTP protocol violation
-
-