Microsoft
Software
Hardware
Network
Question : Getting a console warning when reading a POST response? (HttpURLConnection)
Hi,
I'm making an http post (which is working fine) but I'm getting a console warning:
org.apache.commons.httpcli
ent.HttpMe
thodBase getResponseBody
WARNING: Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
here's my code:
URL url = new URL(urlPath);
httpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(tru
e);
connection.setRequestMetho
d("POST");
OutputStreamWriter writer = new OutputStreamWriter(connect
ion.getOut
putStream(
));
writer.write("param1=" + URLEncoder.encode("blah", "UTF-8"));
writer.close();
if (connection.getResponseCod
e() == HttpURLConnection.HTTP_OK)
{
InputStream inputStream = connection.getInputStream(
);
StringWriter sw = new StringWriter();
int x;
while ((x = inputStream.read()) != -1) {
sw.write(x);
}
inputStream.close();
}
Is there a different way to read the response which doesn't generate this error?
Thanks
Answer : Getting a console warning when reading a POST response? (HttpURLConnection)
you can ignore that warning as its coming from jetty and will go away when you deploy to GAE.
Basically jetty uses getResponseBody regardless of body size, so HttpClient warns you.
Random Solutions
HTTPS keeps Rest connection [RST,ACK]
DELL LATITUDE D610 80GIG STUCK IN BOOT LOOP
Delphi Pagecontrol - each Tabsheet has its own popup menu
Return Ref
Blackberry browser 400 error - socketexception Connection reset
ASP Connection String vs. Database Access DLL
iPhone citrix reciever with Citrix Access Gateway
Is there a way to use visual basic 6 to write data directly to a cd or dvd for windows, xp, vista and 7
SSRS 2008 Data-Driven Subscription Errors - Email not sent
No Networking Installed on Windows 2008 VM After Migrating From VMWARE Server to ESXi Server