org.apache.http.impl.entity
Class StrictContentLengthStrategy
java.lang.Object
   org.apache.http.impl.entity.StrictContentLengthStrategy
org.apache.http.impl.entity.StrictContentLengthStrategy
- All Implemented Interfaces: 
- ContentLengthStrategy
- @Contract(threading=IMMUTABLE)
public class StrictContentLengthStrategy 
- extends Object- implements ContentLengthStrategy
The strict implementation of the content length strategy. This class
 will throw ProtocolException if it encounters an unsupported
 transfer encoding or a malformed Content-Length header
 value.
 
 This class recognizes "chunked" and "identitiy" transfer-coding only.
- Since:
- 4.0
 
 
| Constructor Summary | 
| StrictContentLengthStrategy()Creates
 StrictContentLengthStrategyinstance. | 
| StrictContentLengthStrategy(int implicitLen)Creates
 StrictContentLengthStrategyinstance with the given length used per default
 when content length is not explicitly specified in the message. | 
 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
INSTANCE
public static final StrictContentLengthStrategy INSTANCE
StrictContentLengthStrategy
public StrictContentLengthStrategy(int implicitLen)
- Creates StrictContentLengthStrategyinstance with the given length used per default
 when content length is not explicitly specified in the message.
 
- Parameters:
- implicitLen- implicit content length.
- Since:
- 4.2
 
StrictContentLengthStrategy
public StrictContentLengthStrategy()
- Creates StrictContentLengthStrategyinstance.ContentLengthStrategy.IDENTITYis used per default when content length is not explicitly specified in the message.
 
determineLength
public long determineLength(HttpMessage message)
                     throws HttpException
- Description copied from interface: ContentLengthStrategy
- Returns length of the given message in bytes. The returned value
 must be a non-negative number, ContentLengthStrategy.IDENTITYif the end of the
 message will be delimited by the end of connection, orContentLengthStrategy.CHUNKEDif the message is chunk coded
 
- 
- Specified by:
- determineLengthin interface- ContentLengthStrategy
 
- 
- Parameters:
- message- HTTP message
- Returns:
- content length, ContentLengthStrategy.IDENTITY, orContentLengthStrategy.CHUNKED
- Throws:
- HttpException- in case of HTTP protocol violation
 
Copyright © 2005–2020 The Apache Software Foundation. All rights reserved.