aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Reasoning of response buffer manipulation" Watch "Reasoning of response buffer manipulation" New topic
Author

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
Rancher

Joined: Mar 22, 2000
Posts: 12805
    
    5
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.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reasoning of response buffer manipulation