• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reasoning of response buffer manipulation

 
D Rog
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can somebody provide useful examples when servlet set buffer size, flush and reset?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic