I need to use the response.setContentLength() method in my servlet, but I'm not sure how to determine the content length of the actual data I will be sending. I'm working with a basic struts app.
If you write the data into a ByteArrayOutputStream first, you will be able to use the resulting size() and then write the buffer to the response output stream.