JSP and response object size  
Author Message
nicogf





PostPosted: 2003-8-11 18:08:00 Top

java-programmer, JSP and response object size Is there any way to know the size of a JSP (amount of bytes sent in the
response object)?

We need to know the size of the generated JSP when they are sent to the
client. I can only ask for the buffer size... but no the real amount of
bytes sent in the response object.

Any idea???


Thanks in advance
 
sandipchitale





PostPosted: 2003-8-12 0:55:00 Top

java-programmer >> JSP and response object size Have you tried splicing a subclass of JspWriter which also has behaviour similar
to java.io.FilterWriter with the original JspWriter as the delegate?
In your subclass you could count the bytes or chars or both. This is based on
the guarentee by JSP spec of the existance of implicit object 'out'.

You should do this at the very top of the page.

Something like this:

public class CountingJspWriter extends JspWriter {
private JspWriter _realOut;

public CountingJspWriter(JspWriter out)
{
_realOut = out;
}

// delegate all calls to _realOut in each output method
// after counting the bytes or chars

public int getWrittenCharCount() {
{
//
}

public int getWrittenByteCount() {
{
//
}
}


At the top of the page do

out = new CountingJspWriter(out);

May work...

HTH,
sandip

email***@***.com (Nicolas Gonzalez) wrote in message news:<email***@***.com>...
> Is there any way to know the size of a JSP (amount of bytes sent in the
> response object)?
>
> We need to know the size of the generated JSP when they are sent to the
> client. I can only ask for the buffer size... but no the real amount of
> bytes sent in the response object.
>
> Any idea???
>
>
> Thanks in advance