This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes response flush & close... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "response flush & close..." Watch "response flush & close..." New topic
Author

response flush & close...

Dave Brown
Ranch Hand

Joined: Mar 08, 2005
Posts: 301
Hi all,

Just wondering about the relevance of response.flush() and close();

Does it help the servlet container/client browser behave by ensuring you have a flush() or a close() after a servlet has done its main business?

Rgds,

Dave


Regards, Dave Brown
SCJP 6 - [url]http://www.dbws.net/[/url] - Check out Grails Forum
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63208
    
  69

I think it is best to let the container handle the stream unless you have a good reason to intervene.
[ December 14, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3740
    
  10

There is an autoFlush attribute you can set on the page context to handle this.

In general, though, you only call flush() if you need to send user data during a long running process that has not completed yet. Other than that, you don't have to worry about it.


[OCA 8 Book] [Blog]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: response flush & close...
 
It's not a secret anymore!