| Author |
HttpServletResponse content size?
|
Ralf Rottmann
Greenhorn
Joined: Dec 07, 2003
Posts: 25
|
|
Hi there, I have a servlet which sends a lot of text to the response PrintWriter based on a db lookup. At the end of each paged served by this servlet I want to output an info about the size of the page the web visitor just has retrieved, e.g.: "This page is 36.340 bytes in size." Any idea how to do this? There seems to be no getContentSize method available in HttpServletResponse.
|
-----------------------------<br /><a href="http://www.rottmann.net" target="_blank" rel="nofollow">http://www.rottmann.net</a><p>"The real voyage of discovery consists not in making new landscapes but in having new eyes." <br />Marcel Proust (1871-1922)
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
|
|
You could create a StringWriter as a local buffer and write everything to it , get the size, then output the resulting String. Bill
|
 |
Ralf Rottmann
Greenhorn
Joined: Dec 07, 2003
Posts: 25
|
|
|
How do I output the StringWriter via the response-Object?
|
 |
Pradeep bhatt
Ranch Hand
Joined: Feb 27, 2002
Posts: 8876
|
|
Check the example under Programming Customized Requests and Responses http://java.sun.com/products/servlet/Filters.html
|
Groovy
|
 |
 |
|
|
subject: HttpServletResponse content size?
|
|
|