Code example for DefaultHttpClient

Methods: setParams

0
    /** 
     * initialize the general property fields 
     */ 
    private void initialize() 
    { 
        client = new DefaultHttpClient();
        //set http params 
        HttpParams params= new BasicHttpParams();
        HttpConnectionParams.setConnectionTimeout(params, 10000);// try 10 seconds to get a socket connection
        HttpConnectionParams.setSoTimeout(params, 20000);// wait 30 seconds waiting for data. then break connection.
        client.setParams(params);
     } 
 
    /** 
     * set user credentials with manually developed preemtive Auth 
     */ 
    private void setCredentials() 
    { 
        if (isSecured) {
 
            // Setting preemtiveAuth manually since org.apache.http does not support it