This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Servlets and the fly likes Reasoning of response buffer manipulation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Reasoning of response buffer manipulation" Watch "Reasoning of response buffer manipulation" New topic

Reasoning of response buffer manipulation

D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Can somebody provide useful examples when servlet set buffer size, flush and reset?

Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13018
Buffer size - the default is usually good

flush() - do this after you have written some output and are about to start a process that may be time consuming or may fail. This ensures that the user sees something instead of a blank screen. Also do a flush after you are sure all output has been written.

reset() - pretty tricky - this allows you to completely change the response headers and any body in the buffer - BUT could easily throw an IllegalStateException. I would consider reset() a symptom of bad design. If you think you need to use reset, its time to back off and rethink your architecture.

I agree. Here's the link:
subject: Reasoning of response buffer manipulation
jQuery in Action, 3rd edition