GeeCON Prague 2014*
The moose likes Servlets and the fly likes When is a response committed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "When is a response committed" Watch "When is a response committed" New topic
Author

When is a response committed

Nila dhan
Ranch Hand

Joined: Sep 15, 2005
Posts: 160
I am not sure if my question is correct or incorrect.When is a response committed?I mean under what circumstances?
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3710
    
    5

If by committed you mean sent to the user, it happens at the end of a servlet call or if a flush() of the output stream is invoked.

One common use of flush() is to output data to the screen for the user to see before a long process is complete, such as a task that would require the user to wait 5 minutes. Its preferable to give them an update status during that 5 minutes than having them watch a screen that just says 'loading'.


My Blog: Down Home Country Coding with Scott Selikoff
Nila dhan
Ranch Hand

Joined: Sep 15, 2005
Posts: 160
The response is also committed when the buffer gets filled if i am right.
Are there any other cases when a response is committed without calling flush or forwarding the response?
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Nila, you are correct. If in the process of writing to the response the buffer gets full, it will be implicitly flushed.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
GeeCON Prague 2014
 
subject: When is a response committed