hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chandra <catchma...@gmail.com>
Subject Set HttpVersion and Body Content-Type in httpclient-4.3.2
Date Sun, 21 Sep 2014 18:32:28 GMT
Hi ,

I am porting code from commons-httpclient to httpclient 4.3.2. I am facing
difficulties setting the HttpVersion and ContentType  in the below scenario

       HttpUriRequest method1=null;
		boolean isPost = // Set dynamically

 if (isPost) {

                method1 = new HttpPost(mAuthConf.getActionUrl());
                ((HttpPost) method1).setEntity(new

 Note :Here mAuthConf gives authentication configuration
            } else {

                String paramString =
URLEncodedUtils.format(mAuthConf.getParameters(), "utf-8");
                method1 = new

if (Condition to check whether to create Http 1.1 request) {
  *Question 1:*       * Here i need to set the the request to set version as
Http1.1 . *
          I can set using
but it is deprecated in 4.3.2.
Since i am assigning HttpGet or HttpPost  request to
HttpUriRequest(Interface)  object i cannot set the protocol version to this

Is it ok to set the httpversion to Header and set in in Request Config. 

Please do help me on this.

    	} else {
Here we set http protocol version to http 1.0

*Question 2*: In commons-httpclient httpbody content type is set using the
below code
How do i port this in Httpclient 4.3.2.

Please do respond to my queries. I am in great trouble.


View this message in context: http://httpcomponents.10934.n7.nabble.com/Set-HttpVersion-and-Body-Content-Type-in-httpclient-4-3-2-tp24427.html
Sent from the HttpClient-User mailing list archive at Nabble.com.

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

View raw message