Android HttpGet request with a very long URL
<p>I am currently faced to a strange problem.<br>
I have to contact a web service, with a very long URL (there is some XML inside). The length of one of them is <strong>943</strong> characters.<br>
Most of the time, the request failed with a NoHttpResponseException.<br>
I newly added a RetryHandler, which do his job, and the request finally worked, but the execute time was <strong>246</strong> seconds!<br>
I reduced the timeout, to something like 30 seconds, and occasionally, the request work.<br>
Is there something to know about long URL to make it work better?<br>
Or, is it just prohibited on Android?<br>
I precise that all connection with another tinier URL (even like <strong>200</strong> chars) perfectly work.</p>

<p>Here the source code of the Http connection:  </p>

<pre><code>DefaultHttpClient hc = new DefaultHttpClient();
        HttpProtocolParams.setUseExpectContinue(hc.getParams(), false);
        HttpParams httpParameters = hc.getParams();
        // Set the timeout in milliseconds until a connection is established.
        int timeoutConnection = 5000;
        HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
        // Set the default socket timeout (SO_TIMEOUT) 
        // in milliseconds which is the timeout for waiting for data.
        int timeoutSocket = 10000;
        HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
        hc.setParams(httpParameters);

        HttpRequestRetryHandler retryHandler = new HttpRequestRetryHandler() {

            public boolean retryRequest(IOException exception, int executionCount,
                    HttpContext context) {
                // retry a max of x times
                if(executionCount &gt;= 5){
                    return false;
                }
                if(exception instanceof NoHttpResponseException){
                    return true;
                } else if (exception instanceof ClientProtocolException){
                    return true;
                } 
                return false;
            }
        };
        hc.setHttpRequestRetryHandler(retryHandler);

        url = Tool.prepareURL(url);
        Log.d(LogFilter.EXECUTE, url);
        HttpGet get = new HttpGet(url);
        if (eTag != null) {
            get.addHeader(HEADER_IF_NONE_MATCH, eTag);
        }
        long time = System.currentTimeMillis();
        HttpResponse rp = hc.execute(get);
        Log.d(LogFilter.EXECUTE, "temps execute: "+(System.currentTimeMillis()-time));
        return rp;
</code></pre>

<p>Thank you for your time.</p>
