• Post Reply Bookmark Topic Watch Topic
  • New Topic

Commit

 
George Fung
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read some books that describe about "commit" in response for serlvet. Could anyone tell me how to define "commit"? is it res.flush(), res.close or both?
 
Sivasundaram Umapathy
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlet containers generally buffers the output before sending it to the client solely for performance reasons. The "commit" indicates that the contents of the buffer has been been sent to the client.

A response can be considered committed when

1.the flush() is called on the PrintWriter object obtained using ServletResponse.getWriter()
2.ServletResponse.flushBuffer() is called
3.HttpServletResponse.sendError - All the overloaded signatures
4.HttpServletResponse.sendRedirect(String) is called
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!