Code example for HttpParams

Methods: setParameter, x 1

0
	public static HttpClient getHttpClient() {
		HttpClient httpClient = new DefaultHttpClient();
		HttpParams params = httpClient.getParams();
		HttpConnectionParams.setConnectionTimeout(params, HttpUtil.TIME_OUT);
		HttpConnectionParams.setSoTimeout(params, HttpUtil.TIME_OUT);
		params.setParameter("Connection", "keep-alive");
		params.setParameter("Accept-Encoding", "gzip,deflate");
		params.setParameter("Accept-Charset", "GBK,utf-8;q=0.7,*;q=0.3");
		params.setParameter("Accept",
				"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 
		params.setParameter("Accept-Language",
				"zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); 
		params.setParameter(
				"User-Agent", 
				"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31"); 
		return httpClient;
	} 
 
	/** 
	 * 返回一个配置好报头的Jsoup连接. 
	 */