HttpClient经常设置的参数

httpClient.setHttpConnectionManager(new MultiThreadedHttpConnectionManager());

httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(5000);

httpClient.getHttpConnectionManager().getParams().setSotimeOut(5000);

httpClient.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPABILITY);

httpClient.getHostConfiguration().setProxy("ip" , int port);

 

  DefaultMethodRetryHandler retryHandler = new DefaultMethodRetryHandler();
  retryHandler.setRequestSentRetryEnabled(true);
  retryHandler.setRetryCount(1);

   getMethod.setMethodRetryHandler(retryHandler);
   getMethod.getParams().setSoTimeout(10000);
   getMethod.setRequestHeader("Referer", "插插插插");

    getMethod.setRequestHeader("User-Agent", "Firefox Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3");

你可能感兴趣的:(windows,firefox)