On Sat, 2016-10-22 at 13:04 -0400, davidjesse...@aol.com wrote:
> I understand that HttpClient automatically includes the Content-Length 
> request header when passing a StringEntity. But I would like to set the 
> position of the header. But when I include the request header myself I get 
> the following exception 
> 
> 
> "org.apache.http.ProtocolException: Content-Length header already present" 
> 
> 
> 
> 
> Is there anyway to bypass the auto inclusion of the Content-Length header?
> 

If are really convinced this is a good idea you will have to remove
RequestContent interceptor from the protocol processing chain. 

http://hc.apache.org/httpcomponents-client-4.5.x/httpclient/xref/org/apache/http/impl/client/HttpClientBuilder.html#1079

The only way to do so it set a custom HttpProcessor when building
HttpClient instance with HttpClientBuilder. This can be done but one
needs to be careful when assembling a custom HttpProcessor. There are
several protocol interceptors whose absence in the protocol processing
chain is very likely to cause unexpected behavior. 

Proceed at your own risk.

Oleg  



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to