WARN警告:Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended

使用Apache HttpClient发送请求,有大量WARN警告:Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended
原因:使用了 getResponseBodyAsString()的缘故
修改:getResponseBodyAsStream(),如下:
public Response get(String url, NameValuePair[] params) {
Response response = new Response();
GetMethod method = new GetMethod(url);
method.setQueryString(params);
method.getParams().setContentCharset(UTF8);
try {
response.setStatusCode(httpClient.executeMethod(method));
// 使用getResponseBodyAsStream()代替getResponseBodyAsString使用流的方式来接收
// response.setBody(method.getResponseBodyAsString());
InputStream inputStream = method.getResponseBodyAsStream();
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
StringBuffer stringBuffer = new StringBuffer();
String str = "";
while ((str = br.readLine()) != null) {
stringBuffer.append(str);
}
response.setBody(stringBuffer.toString());
return response;
} catch (Exception e) {
e.getStackTrace();
} finally {
method.releaseConnection();
}
return null;
}
WARN警告:Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended的更多相关文章
- Java-httpClient警告: Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
使用HttpClient,总是报出“Going to buffer response body of large or unknown size. Using getResponseBodyAsStr ...
- 关于http客户端常见错误"警告:Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is rec"
在开发过程中,经常得写http客户端测试接口服务,今天在使用过程中出现了这样的一个警告: 警告: Going to buffer response body of large or unknown s ...
- httpClient使用中报错org.apache.commons.httpclient.HttpMethodBase - Going to buffer response body of large or unknown size.
在使用HttpClient发送请求,使用httpMethod.getResponseBodyAsString();时当返回值过大时会报错: org.apache.commons.httpclient. ...
- dubbo服务provider方打印警告日志,getDeserializer - Hessian/Burla 'xxx' is an unknown class
2018-09-12 16:16:44 WARN [New I/O worker #1] SerializerFactory.java:652 getDeserializer - Hessian/Bu ...
- 警告: Hessian/Burlap: 'com.github.pagehelper.Page' is an unknown class in WebappClassLoader
项目中使用mybatis的分页插件pagehelper出现下面的警告 出现上面的警告,并不影响程序的运行.但是毕竟看着比较闹心. 使用debug进行代码根据发现,执行的过程中使用到了pagehelpe ...
- tomcat中间件提交表单数据量过大警告处理方案
http://www.bubuko.com/infodetail-976418.html http://www.cnblogs.com/yg_zhang/p/4248061.html tomcat中间 ...
- HttpClient_使用httpclient必须知道的参数设置及代码写法、存在的风险
结论: 如果使用httpclient 3.1并发量比较大的项目,最好升级到httpclient4.2.3上,保证并发量大时能抗住.httpclient 4.3.3,目前还有一些bug:还是用4.2.x ...
- 使用httpclient必须知道的参数设置及代码写法、存在的风险
转发地址:http://jinnianshilongnian.iteye.com/blog/2089792 结论: 如果使用httpclient 3.1并发量比较大的项目,最好升级到httpclien ...
- 任务调度中心xxl-job对外接口使用
xxl-job主要分为调度中心和执行器提供了图像化界面,操作简单上手快,基本实现定时任务自动执行,同时可以针对任务日志进行查看.具体xxl-job可以再github上下载:https://github ...
随机推荐
- POJ1511 Invitation Cards —— 最短路spfa
题目链接:http://poj.org/problem?id=1511 Invitation Cards Time Limit: 8000MS Memory Limit: 262144K Tota ...
- lucene Index Store TermVector 说明
最新的lucene 3.0的field是这样的: Field options for indexingIndex.ANALYZED – use the analyzer to break the Fi ...
- POJ3696:The Luckiest number(欧拉函数||求某数最小的满足题意的因子)
Chinese people think of '8' as the lucky digit. Bob also likes digit '8'. Moreover, Bob has his own ...
- MYSQL数据库学习----MYSQL数据类型
一切数据在计算中都是以二进制形式存储,而8位二进制数就表示1个字节. 通常我们说一种数据类型占多少字节,就是说这种数据类型可以表示多少位的二进制数,同时二进制数可以转换为十进制数,进而得到这种数据类型 ...
- 如何让虚拟机的Ubuntu上网?
先声明 本文使用的虚拟机: VMware Workstation 14 Pro 本文使用的Ubuntu : ARM裸机1期加强版配套的Ubuntu16.04 特别注意:如果你使用的虚拟机和Ubuntu ...
- Ubuntu中字体的改变
1.sudo dpkg-reconfigure console-setup 2.弹出 Configuring console-setup 界面,选择适当的编码格式,我们一般选择默认的UTF-8,选择O ...
- 利用jenkins和docker实现持续交付
利用jenkins和docker实现持续交付 一.什么是持续交付 让软件产品的产出过程在一个短周期内完成,以保证软件可以稳定.持续的保持在随时可以发布的状况.它的目标在于让软件的构建.测试与发布变得更 ...
- IT兄弟连 JavaWeb教程 Servlet线程安全问题
在Internet中,一个Web应用可能被来自西面八方的客户并发访问(即同时访问),而且有可能这些客户并发访问的是Web应用中的同一个Servlet,Servlet容器为了保证能同时相应多个客户端要求 ...
- vue移动端开发全家桶
一句命令搞定全家桶: npm install vue-router vue-resource vuex --save main.js配置: import Vue from 'vue' impor ...
- IDEA远程调试hadoop程序
远程调试Hadoop各组件 Hadoop学习之配置Eclipse远程调试Hadoop IDEA远程调试hadoop Hadoop 研发之远程调试详细剖析--WordCount V2.0 eclipse ...