Top Description Fields Constructors Methods
org.apache.http.protocol

public Class ResponseContent

extends Object
implements HttpResponseInterceptor
Class Inheritance
All Implemented Interfaces
org.apache.http.HttpResponseInterceptor
Annotations
@Contract
threading:IMMUTABLE
Imports
java.io.IOException, org.apache.http.HttpEntity, .HttpException, .HttpResponse, .HttpResponseInterceptor, .HttpStatus, .HttpVersion, .ProtocolException, .ProtocolVersion, org.apache.http.annotation.ThreadingBehavior, .Contract, org.apache.http.util.Args

ResponseContent is the most important interceptor for outgoing responses. It is responsible for delimiting content length by adding Content-Length or Transfer-Content headers based on the properties of the enclosed entity and the protocol version. This interceptor is required for correct functioning of server side protocol processors.
Since
4.0

Field Summary

Modifier and TypeField and Description
private final boolean

Constructor Summary

AccessConstructor and Description
public
ResponseContent()

Default constructor.

public
ResponseContent(final boolean
If set to true the Content-Length and Transfer-Encoding headers will be created or updated if already present. If set to false the Content-Length and Transfer-Encoding headers will cause the interceptor to throw ProtocolException if already present in the response message.
overwrite
)

Constructor that can be used to fine-tune behavior of this interceptor.

Method Summary

Modifier and TypeMethod and Description
public void
process(final HttpResponse
The HttpResponse to modify.
response
,
final HttpContext
Unused.
context
)

Implements org.apache.http.HttpResponseInterceptor.process.

Processes the response (possibly updating or inserting) Content-Length and Transfer-Encoding headers.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

overwriteback to summary
private final boolean overwrite

Constructor Detail

ResponseContentback to summary
public ResponseContent()

Default constructor. The Content-Length or Transfer-Encoding will cause the interceptor to throw ProtocolException if already present in the response message.

ResponseContentback to summary
public ResponseContent(final boolean overwrite)

Constructor that can be used to fine-tune behavior of this interceptor.

Parameters
overwrite:boolean

If set to true the Content-Length and Transfer-Encoding headers will be created or updated if already present. If set to false the Content-Length and Transfer-Encoding headers will cause the interceptor to throw ProtocolException if already present in the response message.

Since
4.2

Method Detail

processback to summary
public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException

Implements org.apache.http.HttpResponseInterceptor.process.

Processes the response (possibly updating or inserting) Content-Length and Transfer-Encoding headers.

Parameters
response:HttpResponse

The HttpResponse to modify.

context:HttpContext

Unused.

Annotations
@Override
Exceptions
HttpException:

Doc from org.apache.http.HttpResponseInterceptor.process.

in case of an HTTP protocol violation

IOException:

Doc from org.apache.http.HttpResponseInterceptor.process.

in case of an I/O error

ProtocolException:
If either the Content-Length or Transfer-Encoding headers are found.
IllegalArgumentException:
If the response is null.