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
Solaris 10 zone fails to start up
Does OpenOffice allow Windows 7 preview pane to preview .doc and .xls files?
Cisco VPN Client 5.0.07.0290 on Windows 7 64 bit
VMware Workstation 7.1 Won't Install
How to sync iphone 3.1.3 with exchange server 2003
Decode PHP file
IBM Think Pad HD error
What do you think about these specs for a new System Center Operations/Configurations Manager 2007 R2 server?
Moving .piv and .stm Exchange 2003 files to another drive
net share system error 5 acces denied