Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid project using httpclient --> http.client (apache), post/get method
    text
    copied!<p>I'm doing a Get and Post method for an android project and I need to "translate" HttpClient 3.x to HttpClient 4.x (using by android). My problem is that I'm not sure of what I have done and I don't find the "translation" of some methods...</p> <p>This is the HttpClient 3.x I have done and (-->) the HttpClient 4.x "translation" if I have found it (Only parties who ask me problems) : </p> <pre><code>HttpState state = new HttpState (); --&gt; ? HttpMethod method = null; --&gt; HttpUriRequest httpUri = null; method.abort(); --&gt; httpUri.abort(); //httpUri is a HttpUriRequest method.releaseConnection(); --&gt; conn.disconnect(); //conn is a HttpURLConnection state.clearCookies(); --&gt; cookieStore.clear(); //cookieStore is a BasicCookieStore HttpClient client = new HttpClient(); --&gt; DefaultHttpClient client = new DefaultHttpClient(); client.getHttpConnectionManager().getParams().setConnectionTimeout(SOCKET_TIMEOUT) --&gt; HttpConnectionParams.setConnectionTimeout(param, SOCKET_TIMEOUT); client.setState(state); --&gt; ? client.getParams().setCookiePolicy(CookiePolicy.RFC_2109); --&gt; HttpClientParams.setCookiePolicy(param, CookiePolicy.RFC_2109); PostMethod post = (PostMethod) method; --&gt; ? post.setRequestHeader(...,...); --&gt; conn.setRequestProperty(...,...); post.setFollowRedirects(false); --&gt; conn.setFollowRedirects(false); RequestEntity tmp = null; --&gt; ? tmp = new StringRequestEntity(...,...,...); --&gt; ? int statusCode = client.executeMethod(post); --&gt; ? String ret = method.getResponsBodyAsString(); --&gt; ? Header locationHeader = method.getResponseHeader(...); --&gt; ? ret = getPage(...,...); --&gt; ? </code></pre> <p>I don't know if that is correct. This has caused problems because the packages are not named similarly, and some methods too. I just need documentation (I haven't found) and little help.</p> <p>Thank you in advance for your help. Michaël</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload