解决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

            //returnBody = 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);
            }
            returnBody=stringBuffer.toString();

 

你可能感兴趣的:(解决WARN警告:Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended)