本文主要是介绍HttpClient解决getResponseBodyAsString()报警告问题Using getResponseBodyAsStream instead is recommended,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
//5.读取内容//String responseMsg = postMethod.getResponseBodyAsString().trim();//########################################################////解决报警告的问题WARN : org.apache.commons.httpclient.HttpMethodBase - //Going to buffer response body of large or unknown size. //Using getResponseBodyAsStream instead is recommended.InputStream is = postMethod.getResponseBodyAsStream();BufferedReader br = new BufferedReader(new InputStreamReader(is));StringBuffer sb = new StringBuffer();String str= "";while((str = br.readLine()) != null){sb.append(str);}String responseMsg = sb.toString();//########################################################////System.out.println("responseMsg:" + responseMsg);
这篇关于HttpClient解决getResponseBodyAsString()报警告问题Using getResponseBodyAsStream instead is recommended的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!