views:

43

answers:

1

I'm using Spring 3 and every time I submit a HTML form to a Spring controller I get this message, which I don't understand:

org.apache.commons.httpclient.HttpMethodBase getResponseBody
WARNING: Going to buffer response body of large or unknown size. 
Using getResponseBodyAsStream instead is recommended.

Is there a configuration change I can make in Spring to avoid this?

+4  A: 

This occurs with the commons-httpclient API when the getResponseBody() method is used. The warning means that a response body could potentially be very large (such as a large file download, etc.) and loading the whole thing into memory at once as a String could be very inefficient. The way to avoid this potential inefficiency is to use getResponseBodyAsStream(), which will allow proper buffering and streaming of the response body.

I am not sure why Spring is using getResponseBody(). Could it be your HTTP client? Are you using a custom-written HTTP client to perform the request?

James Earl Douglas
I'm not sure what you mean by "a custom-written HTTP client". I'm using Spring/Jetty on the server side and Firefox on the client side.
Linc
I thought you might be using your own HTTP client in a unit test, for example. Since you're using Firefox the warning is likely triggered by Spring's use of getResponseBody(). If that's the case, I wouldn't worry too much about it. You can change your log4j configuration to suppress the warning if it bothers you, but it's not likely a cause for alarm.
James Earl Douglas