httpclient 响应乱码怎么获取响应值

HttpClient获取并解析JSON数据
我的图书馆
HttpClient获取并解析JSON数据
package com.example.
import java.io.BufferedR
import java.io.InputStreamR
import java.util.ArrayL
import java.util.HashM
import java.util.L
import java.util.M
import org.apache.http.HttpE
import org.apache.http.HttpR
import org.apache.http.HttpS
import org.apache.http.NameValueP
import org.apache.http.client.HttpC
import org.apache.http.client.entity.UrlEncodedFormE
import org.apache.http.client.methods.HttpG
import org.apache.http.client.methods.HttpP
import org.apache.http.client.params.HttpClientP
import org.apache.http.impl.client.DefaultHttpC
import org.apache.http.message.BasicNameValueP
import org.apache.http.params.BasicHttpP
import org.apache.http.params.HttpConnectionP
import org.apache.http.params.HttpP
import org.json.JSONA
import org.json.JSONO
import android.app.A
import android.os.B
public class MainActivity extends Activity {
private final String uriString="your url";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//服务器返回的JSON数据
JSONObject jsonObject=this.getJSONObjectByGet();
//从JSON中得到字符串
String apiString=jsonObject.getString("api");
String countString=jsonObject.getString("count");
System.out.println("apiString="+apiString+",countString="+countString);
//从JSON中得到JSONArray,并且遍历
JSONArray jsonArray=jsonObject.getJSONArray("data");
for (int i = 0; i & jsonArray.length(); i++) {
JSONObject everyJsonObject=jsonArray.getJSONObject(i);
String category_id=everyJsonObject.getString("category_id");
String category_name=everyJsonObject.getString("category_name");
String category_rgb=everyJsonObject.getString("category_rgb");
String category_news_count=everyJsonObject.getString("category_news_count");
System.out.println("category_id="+category_id+",category_name="+category_name+
",category_rgb="+category_rgb+",category_news_count="+category_news_count);
System.out.println("=====================================================");
} catch (Exception e) {
e.printStackTrace();
//得到HttpClient
public HttpClient getHttpClient(){
HttpParams mHttpParams=new BasicHttpParams();
//设置网络链接超时
//即:Set the timeout in milliseconds until a connection is established.
HttpConnectionParams.setConnectionTimeout(mHttpParams, 20*1000);
//设置socket响应超时
//即:in milliseconds which is the timeout for waiting for data.
HttpConnectionParams.setSoTimeout(mHttpParams, 20*1000);
//设置socket缓存大小
HttpConnectionParams.setSocketBufferSize(mHttpParams, 8*1024);
//设置是否可以重定向
HttpClientParams.setRedirecting(mHttpParams, true);
HttpClient httpClient=new DefaultHttpClient(mHttpParams);
return httpC
//得到JSONObject(Get方式)
public JSONObject getJSONObjectByGet(){
JSONObject resultJsonObject=
if ("".equals(uriString)||uriString==null) {
HttpClient httpClient=this.getHttpClient();
StringBuilder urlStringBuilder=new StringBuilder(uriString);
StringBuilder entityStringBuilder=new StringBuilder();
//利用URL生成一个HttpGet请求
HttpGet httpGet=new HttpGet(urlStringBuilder.toString());
BufferedReader bufferedReader=
HttpResponse httpResponse=
//HttpClient发出一个HttpGet请求
httpResponse=httpClient.execute(httpGet);
} catch (Exception e) {
e.printStackTrace();
//得到httpResponse的状态响应码
int statusCode=httpResponse.getStatusLine().getStatusCode();
if (statusCode==HttpStatus.SC_OK) {
//得到httpResponse的实体数据
HttpEntity httpEntity=httpResponse.getEntity();
if (httpEntity!=null) {
bufferedReader=new BufferedReader
(new InputStreamReader(httpEntity.getContent(), "UTF-8"), 8*1024);
String line=
while ((line=bufferedReader.readLine())!=null) {
entityStringBuilder.append(line+"/n");
//利用从HttpEntity中得到的String生成JsonObject
resultJsonObject=new JSONObject(entityStringBuilder.toString());
} catch (Exception e) {
e.printStackTrace();
return resultJsonO
//----------------------------------------以下为POST请求
//准备进行POST请求的参数,一般而言将这些参数封装在HashMap中
public JSONObject save(String title, String timelength) throws Exception{
Map&String,String& paramsHashMap = new HashMap&String, String&();
paramsHashMap.put("title", title);
paramsHashMap.put("timelength", timelength);
paramsHashMap.put("method", "save");
String path = "your url";
return getJSONObjectByPost(path, paramsHashMap, "UTF-8");
//得到JSONObject(Post方式)
//此方法此处未调用测试
public JSONObject getJSONObjectByPost(String path,Map&String, String& paramsHashMap, String encoding) {
JSONObject resultJsonObject =
List&NameValuePair& nameValuePairArrayList = new ArrayList&NameValuePair&();
// 将传过来的参数填充到List&NameValuePair&中
if (paramsHashMap != null && !paramsHashMap.isEmpty()) {
for (Map.Entry&String, String& entry : paramsHashMap.entrySet()) {
nameValuePairArrayList.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
UrlEncodedFormEntity entity =
// 利用List&NameValuePair&生成Post请求的实体数据
// 此处使用了UrlEncodedFormEntity!!!
entity = new UrlEncodedFormEntity(nameValuePairArrayList, encoding);
HttpPost httpPost = new HttpPost(path);
// 为HttpPost设置实体数据
httpPost.setEntity(entity);
HttpClient httpClient = this.getHttpClient();
// HttpClient发出Post请求
HttpResponse httpResponse = httpClient.execute(httpPost);
if (httpResponse.getStatusLine().getStatusCode() == 200) {
// 得到httpResponse的实体数据
HttpEntity httpEntity = httpResponse.getEntity();
if (httpEntity != null) {
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(httpEntity.getContent(),"UTF-8"), 8 * 1024);
StringBuilder entityStringBuilder = new StringBuilder();
String line =
while ((line = bufferedReader.readLine()) != null) {
entityStringBuilder.append(line + "/n");
// 利用从HttpEntity中得到的String生成JsonObject
resultJsonObject = new JSONObject(entityStringBuilder.toString());
} catch (Exception e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
return resultJsonO
TA的最新馆藏
喜欢该文的人也喜欢&!--&自动扫描且只扫描@Controller&--&
&context:component-scan&base-package="com.wiselong.multichannel"&use-default-filters="false"&
&&&&&context:include-filter&type="annotation"&expression="org.springframework.stereotype.Controller"&/&
&/context:component-scan&
@Controller
@RequestMapping(value&=&"/api/platform/exceptioncenter/exceptioninfo")
public&class&ExceptionInfoController&{
&&&&@Autowired
&&&&private&ExceptionInfoBiz&exceptionInfoB
&&&&&*&创建异常信息请求
&&&&&*&@param&requestBody&请求消息内容
&&&&&*&@param&request&请求消息头
&&&&&*&@return&jsonObject
&&&&@RequestMapping(
&&&&&&&&&&&&value="/create",
&&&&&&&&&&&&method&=&RequestMethod.POST
&&&&public&ModelAndView&createExceptionInfo(@RequestBody&String&requestBody,&HttpServletRequest&request)&{
&&&&&&&&JSONObject&jsonObject&=&JSONObject.fromObject(requestBody);
&&&&&&&&ComExceptionInfo&comExceptionInfo&=&new&ComExceptionInfo();
&&&&&&&&comExceptionInfo.setProjectName(jsonObject.getString("projectName"));
&&&&&&&&comExceptionInfo.setTagName(jsonObject.getString("tagName"));
&&&&&&&&exceptionInfoBiz.insert(comExceptionInfo);
&&&&&&&&JSONObject&result=&new&JSONObject();
&&&&&&&&result.put("success",&"true");
&&&&&&&&return&new&ModelAndView("",&ResponseUtilsHelper.jsonSuccess(result.toString()));
阅读(...) 评论() &HttpClient学习系列 -- 学习总结 - hry - ITeye博客
博客分类:
HttpClient 4.x版本
HttpComponents 包括 HttpCore包和HttpClient包
HttpClient:Http的执行http请求
DefaultHttpClient:httpClient默认实现
HttpGet、HttpPost:Get、Post方法执行类
HttpResponse:执行返回的Response,含http的header和执行结果实体Entity
HttpEntity:Http返回结果实体,不含Header内容
HttpParam:连接参数,配合连接池使用
PoolingClientConnectionManager:连接池
基础Get方法
// 默认的client类。
HttpClient client = new DefaultHttpClient();
// 设置为get取连接的方式.
HttpGet get = new HttpGet(url);
// 得到返回的response.
HttpResponse response = client.execute(get);
// 得到返回的client里面的实体对象信息.
HttpEntity entity = response.getEntity();
if (entity != null) {
System.out.println( entity.getContentEncoding());
System.out.println( entity.getContentType());
// 得到返回的主体内容.
InputStream instream = entity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(instream, encoding));
System.out.println(reader.readLine());
// EntityUtils 处理HttpEntity的工具类
// System.out.println(EntityUtils.toString(entity));
// 关闭连接.
client.getConnectionManager().shutdown();
基础Post方法
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(url);
// 添加参数
List&NameValuePair& formparams = new ArrayList&NameValuePair&();
formparams.add(new BasicNameValuePair("p", "1"));
formparams.add(new BasicNameValuePair("t", "2"));
formparams.add(new BasicNameValuePair("e", "3"));
UrlEncodedFormEntity urlEntity =
new UrlEncodedFormEntity(formparams, "UTF-8");
httpost.setEntity(urlEntity);
HttpResponse response = httpclient.execute(httpost);
HttpEntity entity = response.getEntity();
System.out.println("Login form get: " + response.getStatusLine() + entity.getContent());
// dump(entity, encoding);
System.out.println("Post logon cookies:");
List&Cookie& cookies = httpclient.getCookieStore().getCookies();
for (int i = 0; i & cookies.size(); i++) {
System.out.println("- " + cookies.get(i).toString());
// 关闭请求
httpclient.getConnectionManager().shutdown();
保留Session,保留用户+密码状态
Demo1,只支持单线程
DefaultHttpClient httpclient = new DefaultHttpClient(
new ThreadSafeClientConnManager());
HttpPost httpost = new HttpPost(url);
// 添加参数
List&NameValuePair& formparams = new ArrayList&NameValuePair&();
formparams.add(new BasicNameValuePair("p", "1"));
formparams.add(new BasicNameValuePair("t", "2"));
formparams.add(new BasicNameValuePair("e", "3"));
// 设置请求的编码格式
httpost.setEntity(new UrlEncodedFormEntity(formparams, Consts.UTF_8));
// 登录一遍
httpclient.execute(httpost);
// 然后再第二次请求普通的url即可。
httpost = new HttpPost(url2);
BasicResponseHandler responseHandler = new BasicResponseHandler();
System.out.println(httpclient.execute(httpost, responseHandler));
httpclient.getConnectionManager().shutdown();
return "";
Demo2:第二次请求带上第一次请求的Cookie
用于在用户+密码等候后,后续根据第一次请求的URL获取的Cookie,把这些Cookie添加到第二次请求的Cookie中
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost(url);
// 添加参数
List&NameValuePair& formparams = new ArrayList&NameValuePair&();
formparams.add(new BasicNameValuePair("uname", name));
formparams.add(new BasicNameValuePair("pass", "e0c10ff76cb85"));
formparams.add(new BasicNameValuePair("auto_login","0"));
formparams.add(new BasicNameValuePair("a","1"));
formparams.add(new BasicNameValuePair("backurl","1"));
UrlEncodedFormEntity urlEntity =
new UrlEncodedFormEntity(formparams, "UTF-8");
httpost.setEntity(urlEntity);
HttpContext localContext = new BasicHttpContext();
HttpResponse response = httpclient.execute(httpost,localContext);
HttpEntity entity = response.getEntity();
// 打印获取值
System.out.println(Arrays.toString(response.getAllHeaders()));
System.out.println(EntityUtils.toString(entity));
// 第二次请求,使用上一次请求的Cookie
DefaultHttpClient httpclient2 = new DefaultHttpClient();
HttpPost httpost2 = new HttpPost("/?_c=index&_a=my");
// 获取上一次请求的Cookie
CookieStore cookieStore2 = httpclient2.getCookieStore();
// 下一次的Cookie的值,将使用上一次请求
CookieStore cookieStore = httpclient.getCookieStore();
List&Cookie& list = cookieStore.getCookies();
for(Cookie o : list){
System.out.println(o.getName() + " = " + o.getValue() + " 12");;
cookieStore2.addCookie(o);
HttpResponse response2 = httpclient2.execute(httpost2);
HttpEntity entity2 = response2.getEntity();
System.out.println(Arrays.toString(response2.getAllHeaders()));
System.out.println(EntityUtils.toString(entity2));
获取访问上下文:
HttpClient httpclient = new DefaultHttpClient();
// 设置为get取连接的方式.
HttpGet get = new HttpGet(url);
HttpContext localContext = new BasicHttpContext();
// 得到返回的response.第二个参数,是上下文,很好的一个参数!
httpclient.execute(get, localContext);
// 从上下文中得到HttpConnection对象
HttpConnection con = (HttpConnection) localContext
.getAttribute(ExecutionContext.HTTP_CONNECTION);
System.out.println("socket超时时间:" + con.getSocketTimeout());
// 从上下文中得到HttpHost对象
HttpHost target = (HttpHost) localContext
.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
System.out.println("最终请求的目标:" + target.getHostName() + ":"
+ target.getPort());
// 从上下文中得到代理相关信息.
HttpHost proxy = (HttpHost) localContext
.getAttribute(ExecutionContext.HTTP_PROXY_HOST);
if (proxy != null)
System.out.println("代理主机的目标:" + proxy.getHostName() + ":"
+ proxy.getPort());
System.out.println("是否发送完毕:"
+ localContext.getAttribute(ExecutionContext.HTTP_REQ_SENT));
// 从上下文中得到HttpRequest对象
HttpRequest request = (HttpRequest) localContext
.getAttribute(ExecutionContext.HTTP_REQUEST);
System.out.println("请求的版本:" + request.getProtocolVersion());
Header[] headers = request.getAllHeaders();
System.out.println("请求的头信息: ");
for (Header h : headers) {
System.out.println(h.getName() + "--" + h.getValue());
System.out.println("请求的链接:" + request.getRequestLine().getUri());
// 从上下文中得到HttpResponse对象
HttpResponse response = (HttpResponse) localContext
.getAttribute(ExecutionContext.HTTP_RESPONSE);
HttpEntity entity = response.getEntity();
if (entity != null) {
System.out.println("返回结果内容编码是:" + entity.getContentEncoding());
System.out.println("返回结果内容类型是:" + entity.getContentType());
连接池和代理:
每次使用最后一句new DefaultHttpClient(cm, httpParams);获取新的HttpClient
里面还有一条如何设置代理
// HttpParams
HttpParams httpParams
= new BasicHttpParams();
// HttpConnectionParams 设置连接参数
// 设置连接超时时间
HttpConnectionParams.setConnectionTimeout(httpParams, 30000);
// 设置读取超时时间
HttpConnectionParams.setSoTimeout(httpParams, 60000);
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(
new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
schemeRegistry.register(
new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
PoolingClientConnectionManager cm = new PoolingClientConnectionManager(schemeRegistry);
// 设置最大连接数
cm.setMaxTotal(200);
// 设置每个路由默认最大连接数
cm.setDefaultMaxPerRoute(20);
// 设置代理和代理最大路由
HttpHost localhost = new HttpHost("locahost", 80);
cm.setMaxPerRoute(new HttpRoute(localhost), 50);
// 设置代理,
HttpHost proxy = new HttpHost("10.36.24.3", 60001);
httpParams.setParameter(ConnRoutePNames.DEFAULT_PROXY,
HttpClient httpClient = new DefaultHttpClient(cm, httpParams);
如果某次请求请求失败,可以自动重连
DefaultHttpClient httpClient = new DefaultHttpClient();
// 可以自动重连
HttpRequestRetryHandler requestRetryHandler2 = new HttpRequestRetryHandler() {
// 自定义的恢复策略
public synchronized boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
// 设置恢复策略,在发生异常时候将自动重试3次
if (executionCount & 3) {
// 超过最大次数则不需要重试
if (exception instanceof NoHttpResponseException) {
// 服务停掉则重新尝试连接
if (exception instanceof SSLHandshakeException) {
// SSL异常不需要重试
HttpRequest request = (HttpRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
boolean idempotent = (request instanceof HttpEntityEnclosingRequest);
if (!idempotent) {
// 请求内容相同则重试
httpClient.setHttpRequestRetryHandler(requestRetryHandler2);
使用自定义ResponseHandler处理返回的请求
HttpClient httpClient = new DefaultHttpClient();
HttpGet get = new HttpGet(url);
// 定义一个类处理URL返回的结果
ResponseHandler&byte[]& handler = new ResponseHandler&byte[]&() {
public byte[] handleResponse(HttpResponse response)
throws ClientProtocolException, IOException {
HttpEntity entity = response.getEntity();
if (entity != null) {
return EntityUtils.toByteArray(entity);
// 不同于 httpClient.execute(request),返回值是HttpResponse;返回值右ResponseHandler决定
byte[] charts = httpClient.execute(get, handler);
FileOutputStream out = new FileOutputStream(fileName);
out.write(charts);
out.close();
httpClient.getConnectionManager().shutdown();
浏览 23463
huangrongyou
浏览: 236843 次
来自: 杭州
使用apache ActiveMQ深入企业级程序设计百度网盘: ...
能不能 提供一下 包
写的很好,很有用,谢谢
顶。谢谢分享
您好,我也用到同样的功能了,但是我的15:14:20,838HttpClient使用post方法提交数据后服务端如何获得这些参数
如题,以下代码使用HttpClient的post方式进行数据的提交
httpClient = getHttpClient();
httpPost = getHttpPost(url, cookie, userAgent);
httpPost.setRequestEntity(new MultipartRequestEntity(parts,httpPost.getParams()));
int statusCode = httpClient.executeMethod(httpPost); 那么在服务端如何获得我提交的这些参数呢?
req.getParameter(&username&);
总是为空,哪位知道,请讲讲啊。
以前用过HttpClient,给你说几个关键的地方吧:
1. 首先,发送的时候
HttpClient client = new HttpClient();
PostMethod method = new PostMethod(URL);//具体method里面还可以设置一下编码,header之类的
//1. 第一种方式,基于Content-Type=‘multipart/form-data’形式的表单
Part[] parts = ...;//FilePart和StringPart都可以放进去
method.setRequestEntity(new MultipartRequestEntity(parts, method.getParams()));
//2. 第二种方式,普通表单
NameValuePair[] pairs = ...;//纯参数了,键值对
method.addParameters(pairs);
client.executeMethod(method);
当然了,还可能有其他的一些形式,这里不过多的说明了,有API可以参考
2. 接收的时候
private void parseRequest(HttpServletRequest request) throws Exception {
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if (isMultipart) {
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List items = upload.parseRequest(request);
for (int i = 0; i & items.size(); i++) {
FileItem item = (FileItem) items.get(i);
if (!item.isFormField()) {
//文件数据
//普通表单数据
Enumeration en = request.getParameterNames();
while (en.hasMoreElements()) {
String paramName = (String) en.nextElement();
String paramValue = request.getParameter(paramName);
} 如上便是我之前写的代码了,接收表单数据,没什么问题
--- 共有 2 条评论 ---
: 这个答案是最佳答案吗
非常感谢你!
req.getPart(&username&)
可以用commons-fileupload组件,更方便些
你哪里提交
username的值?
是你提交的POST有文件上传吧,这种情况下麻烦一点
试试看httpPost.setHeader(“Content-Type”,“application/x-www-form- charset=UTF-8”);
字符集按具体情况来
求解答啊~~楼主解决了么?
--- 共有 2 条评论 ---
: 可不可以粘贴出来您的解决方法源码,求!!
我不是已经设置最佳答案了么?最佳答案就是解决方案。
请问普通的表单数据怎么取出数据呢
可以参考这些httpclient的使用demo代码:HttpClient4.x进行Get/Post请求并使用ResponseHandler处理响应 - yshjava - ITeye博客
博客分类:
查看原文请移步
HTTPClient4之后,基本重写了3的所有代码,使得API用起来更显简单有力,最简单的例子体现在get/post请求以及请求响应结果的处理上。3的时候,需要自己处理响应流,无论是网页编码识别还是代码处理等各方面,非常不便,4之后使用ResponseHandler可以非常方便和简洁地处理上述问题。如下代码演示了如何使用响应处理器(ResponseHandler)来处理HTTP响应。这是执行HTTP请求和处理HTTP响应的推荐方式。这种做法使调用者将注意力集中在处理HTTP响应内容的过程中,并委派任务释放HttpClient所占用的系统资源。ResponseHandler能够保证在任何情况下都会将底层的HTTP连接释放回连接管理器。
以Get方式请求目标网页并使用ResponseHandler处理响应:
package cn.ysh.studio.crawler.
import org.apache.http.client.HttpC
import org.apache.http.client.ResponseH
import org.apache.http.client.methods.HttpG
import org.apache.http.impl.client.BasicResponseH
import org.apache.http.impl.client.DefaultHttpC
* 以Get方式提交请求并使用ResponseHandler简化响应结果的处理
public class GetTest {
public static void main(String[] args) throws Exception {
//目标页面
String url = "";
//创建一个默认的HttpClient
HttpClient httpclient = new DefaultHttpClient();
//以get方式请求网页
HttpGet httpget = new HttpGet(url);
//打印请求地址
System.out.println("executing request " + httpget.getURI());
//创建响应处理器处理服务器响应内容
ResponseHandler&String& responseHandler = new BasicResponseHandler();
//执行请求并获取结果
String responseBody = httpclient.execute(httpget, responseHandler);
System.out.println("----------------------------------------");
System.out.println(responseBody);
System.out.println("----------------------------------------");
} finally {
// 当不再需要HttpClient实例时,关闭连接管理器以确保释放所有占用的系统资源
httpclient.getConnectionManager().shutdown();
以Post方式带参数请求目标网页并使用ResponseHandler处理响应:
package cn.ysh.studio.crawler.
import java.util.ArrayL
import java.util.L
import org.apache.http.NameValueP
import org.apache.http.client.HttpC
import org.apache.http.client.ResponseH
import org.apache.http.client.entity.UrlEncodedFormE
import org.apache.http.client.methods.HttpP
import org.apache.http.impl.client.BasicResponseH
import org.apache.http.impl.client.DefaultHttpC
import org.apache.http.message.BasicNameValueP
* 以Post方式提交请求并使用ResponseHandler简化响应结果的处理
public class PostTest {
public static void main(String[] args) throws Exception {
//目标页面
String url = "";
//创建一个默认的HttpClient
HttpClient httpclient = new DefaultHttpClient();
//以post方式请求网页
HttpPost httppost = new HttpPost(url);
//添加HTTP POST参数
List &NameValuePair& nvps = new ArrayList &NameValuePair&();
nvps.add(new BasicNameValuePair("username", ""));
nvps.add(new BasicNameValuePair("password", "yshjava"));
//将POST参数以UTF-8编码并包装成表单实体对象
httppost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));
//打印请求地址
System.out.println("executing request " + httppost.getRequestLine().getUri());
//创建响应处理器处理服务器响应内容
ResponseHandler&String& responseHandler = new BasicResponseHandler();
//执行请求并获取结果
String responseBody = httpclient.execute(httppost, responseHandler);
System.out.println("----------------------------------------");
System.out.println(responseBody);
System.out.println("----------------------------------------");
} finally {
// 当不再需要HttpClient实例时,关闭连接管理器以确保释放所有占用的系统资源
httpclient.getConnectionManager().shutdown();
原创文章,转载请注明出处
论坛回复 /
(0 / 5275)
浏览: 208223 次
来自: 上海
楼主你这个右上角的button按钮控件布局是怎么弄的啊
没有AWTUtilities这个类怎么办呀!!!
还有如果我想放一组user对象而不是一个怎么办呢?
请问userList.*是什么意思?
好心博主,我也想要份源码!

我要回帖

更多关于 httpclient 响应时间 的文章

 

随机推荐