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

public Class RequestContent

extends Object
implements HttpRequestInterceptor
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.http.HttpRequestInterceptor
Annotations
@Contract
threading:IMMUTABLE
Imports
java.io.IOException, org.apache.hc.core5.annotation.Contract, .ThreadingBehavior, org.apache.hc.core5.http.EntityDetails, .HeaderElements, .HttpException, .HttpHeaders, .HttpRequest, .HttpRequestInterceptor, .HttpVersion, .Method, .ProtocolException, .ProtocolVersion, org.apache.hc.core5.http.message.MessageSupport, org.apache.hc.core5.util.Args

RequestContent is the most important interceptor for outgoing requests. 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 client side protocol processors.
Since
4.0

Field Summary

Modifier and TypeField and Description
public static final HttpRequestInterceptor
INSTANCE

Singleton instance.

private final boolean

Constructor Summary

AccessConstructor and Description
public
RequestContent()

Default constructor.

public
RequestContent(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 HttpRequest
the request to process
request
,
final EntityDetails
the request entity details or null if not available
entity
,
final HttpContext
the context for the request
context
)

Implements org.apache.hc.core5.http.HttpRequestInterceptor.process.

Processes a request.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
public static final HttpRequestInterceptor INSTANCE

Singleton instance.

Since
5.2
overwriteback to summary
private final boolean overwrite

Constructor Detail

RequestContentback to summary
public RequestContent()

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

RequestContentback to summary
public RequestContent(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 HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException

Implements org.apache.hc.core5.http.HttpRequestInterceptor.process.

Doc from org.apache.hc.core5.http.HttpRequestInterceptor.process.

Processes a request. On the client side, this step is performed before the request is sent to the server. On the server side, this step is performed on incoming messages before the message body is evaluated.

Parameters
request:HttpRequest

the request to process

entity:EntityDetails

the request entity details or null if not available

context:HttpContext

the context for the request

Annotations
@Override
Exceptions
HttpException:
in case of an HTTP protocol violation
IOException:
in case of an I/O error