src/main/java/org/acra/util/HttpRequest.java
/**
     * Posts to a URL.
     *
     * @param url           URL to which to post.
     * @param parameters    Map of parameters to post to a URL.
     * @throws IOException if the data cannot be posted.
     */
Posts to a URL.

@param url           URL to which to post.
@param parameters    Map of parameters to post to a URL.
@throws IOException if the data cannot be posted.
Posts to a URL . @param url URL to which to post . @param parameters Map of parameters to post to a URL . @throws IOException if the data cannot be posted .
public void sendPost(URL url, Map<?, ?> parameters) throws IOException {
        final HttpClient httpClient = getHttpClient();
        final HttpPost httpPost = getHttpPost(url, parameters);
        log.d(ACRA.LOG_TAG, "Sending request to " + url);
        if (ACRA.DEV_LOGGING) log.d(ACRA.LOG_TAG, "HttpPost params : ");
        for (final Object key : parameters.keySet()) {
            if (ACRA.DEV_LOGGING) log.d(ACRA.LOG_TAG, " key : '" + key + "'    value: '" + parameters.get(key) + "'");
        }
        final HttpResponse response = httpClient.execute(httpPost, new BasicHttpContext());
        if (response != null) {
            final StatusLine statusLine = response.getStatusLine();
            if (statusLine != null) {
                final String statusCode = Integer.toString(response.getStatusLine().getStatusCode());
                if (statusCode.startsWith("4") || statusCode.startsWith("5")) {
                    if (ACRA.DEV_LOGGING) log.d(ACRA.LOG_TAG, "Could not send HttpPost : " + httpPost);
                    throw new IOException("Host returned error code " + statusCode);
                }
            }
            if (ACRA.DEV_LOGGING) log.d(ACRA.LOG_TAG, "HttpResponse Status : " + (statusLine != null ? statusLine.getStatusCode() : "NoStatusLine#noCode"));
            final String content = EntityUtils.toString(response.getEntity());
            if (ACRA.DEV_LOGGING) log.d(ACRA.LOG_TAG, "HttpResponse Content : " + content.substring(0, Math.min(content.length(), 200)));
        } else {
            if (ACRA.DEV_LOGGING) log.d(ACRA.LOG_TAG, "HTTP no Response!!");
        }
    }
public void sendPost ( URL url , Map < ? , ? > parameters ) throws IOException { final HttpClient httpClient = getHttpClient ( ) ; final HttpPost httpPost = getHttpPost ( url , parameters ) ; log . d ( ACRA . LOG_TAG , "Sending request to " + url ) ; if ( ACRA . DEV_LOGGING ) log . d ( ACRA . LOG_TAG , "HttpPost params : " ) ; for ( final Object key : parameters . keySet ( ) ) { if ( ACRA . DEV_LOGGING ) log . d ( ACRA . LOG_TAG , " key : '" + key + "'    value: '" + parameters . get ( key ) + "'" ) ; } final HttpResponse response = httpClient . execute ( httpPost , new BasicHttpContext ( ) ) ; if ( response != null ) { final StatusLine statusLine = response . getStatusLine ( ) ; if ( statusLine != null ) { final String statusCode = Integer . toString ( response . getStatusLine ( ) . getStatusCode ( ) ) ; if ( statusCode . startsWith ( "4" ) || statusCode . startsWith ( "5" ) ) { if ( ACRA . DEV_LOGGING ) log . d ( ACRA . LOG_TAG , "Could not send HttpPost : " + httpPost ) ; throw new IOException ( "Host returned error code " + statusCode ) ; } } if ( ACRA . DEV_LOGGING ) log . d ( ACRA . LOG_TAG , "HttpResponse Status : " + ( statusLine != null ? statusLine . getStatusCode ( ) : "NoStatusLine#noCode" ) ) ; final String content = EntityUtils . toString ( response . getEntity ( ) ) ; if ( ACRA . DEV_LOGGING ) log . d ( ACRA . LOG_TAG , "HttpResponse Content : " + content . substring ( 0 , Math . min ( content . length ( ) , 200 ) ) ) ; } else { if ( ACRA . DEV_LOGGING ) log . d ( ACRA . LOG_TAG , "HTTP no Response!!" ) ; } }
Posts to a URL.
Posts to a URL .
// TODO Consider using a RequestRetryHandler and if its a SocketTimeoutException to up the SocketTimeout and try again.
 // See http://stackoverflow.com/questions/693997/how-to-set-httpresponse-timeout-for-android-in-java
 // I think SocketTimeOut while waiting for response may be the cause of the multiple crash reports () - I
