An error is reported when using httpclient to get the return: Going to buffer response body of large or unknown size

An error is reported when using httpclient to request the response: Going to buffer response body of large or unknown size.Using getResponseBodyAsStre

When the above warning using getResponseBodyAsStream Alternatively getResponseBodyAsString acquiring object information returned, modified as follows:
the

String html = postMethod.getResponseBodyAsString();

Replace with:

BufferedReader reader = new BufferedReader(new InputStreamReader(postMethod.getResponseBodyAsStream()));
StringBuffer stringBuffer = new StringBuffer();
String str = "";
while((str = reader.readLine())!=null){
    
    
			stringBuffer.append(str);
}
String 	html=stringBuffer.toString();

Guess you like

Origin blog.csdn.net/qq_41353397/article/details/111823289