This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Consider the following code snippets. What will be displayed on the browser when a GET request is sent to FirstServlet assuming that the buffer is large enough to hold all the data before sending the data to the client?
the answer given is D, which is also correct, but since they are askingWhat will be displayed, I think B should be correct. when a request is "forwarded" to another resource, the buffer should be cleared of the contents generated by the forwarding resource. Therefore, only Page2 will be sent to the client. Now since FirstServlet is trying to write to the response IllegalStateException will be thrown, but that does not appear at client's browser... I have tested this using tomcat 5.0.28, is it tomcat's behaviour or all the containers behave the same?
No. This code wont throw any IllegalStateException. Only 'Page2' will be printed and the buffer of 1st servlet will be cleared before the forward so 'Page1' wont get printed. And if u make a forward and after that if u print something to response, it will be IGNORED. it would not cause any IllegalStateException. Any objections?