androidhttpclient

Volley ignores Cookie header request

北慕城南 提交于 2019-12-10 11:15:01
问题 Good day! My app uses simple http client-server communication, established with Volley library on client side. First, i fire up an authorization request: public class AuthenticationRequest extends StringRequest { private static final String TAG = AuthenticationRequest.class.getSimpleName(); private String login; private String password; public AuthenticationRequest(int method, String url, Response.Listener<String> listener, Response.ErrorListener errorListener) { super(method, url, listener,

HttpURLConnection.getInputStream very slow

坚强是说给别人听的谎言 提交于 2019-12-08 22:08:17
问题 HttpURLConnection.getInputStream takes very much time when compared to iPhone App which uses the same server side services. The following code is used for the service : date= new java.util.Date(); Log.d("time","Time Stamp before posting "+new Timestamp(date.getTime())); URL ur= new URL(url); HttpURLConnection conn = (HttpURLConnection) ur.openConnection(); conn.setRequestProperty("Connection", "close"); conn.setReadTimeout(10000); conn.setConnectTimeout(15000); conn.setRequestMethod("POST");

Handle response properly when used HttpClient

孤街醉人 提交于 2019-12-08 07:33:23
问题 I am developing a android app where I am using Zend framework to build APIs. I am calling API using this code. This is code in IntentService class. HttpClient client = new DefaultHttpClient(); // Set timeout values client.getParams().setIntParameter( CoreConnectionPNames.CONNECTION_TIMEOUT, CONNECTION_TIMEOUT * 1000); client.getParams().setIntParameter(CoreConnectionPNames.SO_TIMEOUT, SOCKET_TIMEOUT * 1000);try { HttpUriRequest httpRequest = null; HttpResponse response = null; // Set

Volley ignores Cookie header request

橙三吉。 提交于 2019-12-06 14:19:50
Good day! My app uses simple http client-server communication, established with Volley library on client side. First, i fire up an authorization request: public class AuthenticationRequest extends StringRequest { private static final String TAG = AuthenticationRequest.class.getSimpleName(); private String login; private String password; public AuthenticationRequest(int method, String url, Response.Listener<String> listener, Response.ErrorListener errorListener) { super(method, url, listener, errorListener); } public void setLogin(String login) { this.login = login; } public void setPassword

Loopj's AsyncHttpclient not setting the correct timeout

女生的网名这么多〃 提交于 2019-12-05 08:45:56
I tried setting my asynchttpclient's timeout in my singleton class but it seems that it doesn't change. I got the 10000 which I think is the default value. client.setMaxRetriesAndTimeout(0,5000); Log.i("loopj", ""+ client.getTimeout()); EDIT: client.setTimeout(5000); this method is working but for the information, how come setMaxRetriesAndTimeout doesn't? Okay, I got it. From the docs , setMaxRetriesAndTimeout - sets the maximum retries and timeout between those retries setTimeout - sets the connect/socket timeout - this one is the 10s by default 来源: https://stackoverflow.com/questions

HTTP Requests in Glass GDK

时间秒杀一切 提交于 2019-12-04 14:12:19
问题 I am implementing a GDK application and need to do in my application some HTTP Post requests. Do I send the HTTP requests the same way as on android phone or there is some other way of doing it? (I have tried the code that I am using on my phone and it's not working for glass.) thanks for your help in advance. 回答1: You can make any post request like in smartphones, but ensure you make the requests using an AsyncTask. For example: private class SendPostTask extends AsyncTask<Void, Void, Void>

Google Volley vs Android-Async-Http

不打扰是莪最后的温柔 提交于 2019-12-04 11:19:36
问题 I am looking into both these Android Http Networking libraries. I would like some peoples experiences with using the two libraries. Personally I have always used the http://loopj.com/android-async-http/ library quite happily. But it was recently suggested to me to use the Volley Framework. What benefits will I get from one over the other? From my reading so far, Volley incorporates a number of nice features such as Image Loading, Request Caching, Request Cancelling all in one library. My

Using cURL commands in Android

青春壹個敷衍的年華 提交于 2019-12-04 04:32:04
问题 I have the following cURL command and I would like to execute the same thing from Android, curl -X POST -H "Content-Type: application/json" -d '{"username":"user","password":"pass"}' http://www.somesite.com/login This is what I made for Andorid, HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://www.somesite.com/login"); try { httppost.addHeader("Content-Type", "application/json"); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);

Loopj messing special characters before sending them through a request

做~自己de王妃 提交于 2019-12-04 02:35:33
问题 I'm trying to send special characters through an http request, now I'm using Loopj as my http client. The problem is that when I try to send special characters i.e. "áéíóú" the request goes out with the characters "·ÈÌÛ˙", this is causing some issues on the server sider. I've gone through the Loopj code and couldn't find anything relative to recoding my string or anything like it. In the worst case it seems like it would be encoded in UTF-8 which actually supports this characters. Hope anyone

Unable to resolve host: URL No address associated with hostname

大城市里の小女人 提交于 2019-12-03 17:47:53
问题 I have an web service call to bring down a JSON object and it only works if I have the IP address and not the host name. I have been fine using IP addresses but now I need to have the host name. Here is my code StringBuilder stringBuilder = new StringBuilder(); HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, 3000); HttpConnectionParams.setSoTimeout(httpParams, 7000); DefaultHttpClient httpClient = new DefaultHttpClient(httpParams); HttpPost