File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes what commits the response ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "what commits the response ?" Watch "what commits the response ?" New topic
Author

what commits the response ?

Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
hfsj says,

flush( ) commits the response.
so we cant call anything on the response ( methods to do sendRedirect( ) and adding/setting things in the response ), once we say flush( ).

my query is if, after the response is commited, and i say
out.println( ), where out is a PrintWriter, what will happen ?


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6588
    
    1

If the response is commited you cant forward to any other servlet. You have to choose. Either commit the response and handle the content yourself or forward to another servlet/JSP without commiting the response


SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 8795

It will give you an IllegalStateException as it is given in the specs.


SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
thanks
 
I agree. Here's the link: http://zeroturnaround.com/jrebel
 
subject: what commits the response ?
 
Similar Threads
sendRedirect()
can sendError be called after flush()??
Confused with flush() behavior
Q on ServletResponse: more ways to commit a response?
cleared, commited and flushed