Hi NigelWhite,
I have a complex object and not s String. I do not want to count byte by byte,
as that will take time.. Hence, wondering if there is a readymade api in tomcat
that i can access.
Thanks for all your help...
View the original post :
http://www.jboss.com/index.html?module=bb&op=v
Just send all output through a method!
| private int responseLength = 0; // zero it at the start of your code!!!
|
| private void write(OutputStream out, String data)
| {
| responseLength += data.length;
| out.write(data);
| }
|
What's wrong with that?
View the original p
Thanks for the response NigelWhite,
Sorry, I forgot to mention the following:
1. I have just one servlet
2. I do not want to go byte by byte in the stream, this will slow down my
response
I see in the status page of the tomcat, the number of bytes in request and
response. Not sure how that is
There's lots of ways. If you want every servlet counted, you can write a
javax.servlet.Filter (You can filter depending on URL pattern so you can be
selective if you want) which passes an HttpServletResponseWrapper which you
would write along the filter chain.
This wrapper's getOutputStream() m