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
UrlEncodedFormEntity(mAuthConf.getParameters(),"utf-8"));
Note :Here mAuthConf gives authentication configuration
} else {
String paramString =
URLEncodedUtils.format(mAuthConf.getParameters(), "utf-8");
method1 = new
HttpGet(mAuthConf.getActionUrl()+"?"+paramString);
}
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
method.getParams.setParameter(CoreProtocolPNames.PROTOCOL_VERSION,HttpVersion.HTTP_1_1)
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
object.
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
HttpClientParams.setContentCharset("UTF-8");
How do i port this in Httpclient 4.3.2.
Please do respond to my queries. I am in great trouble.
Thanks,
Chandra.
--
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: [email protected]
For additional commands, e-mail: [email protected]