Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HF - Chapter 5, Page 215, Question 1 (Errata Version)

 
David Bates
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've looked in the errata of this book and it says that the answer to Question 1 is incorrect.

"When using a RequestDispatcher, the use of which methods can often lead to an IllegalStateException?"
The errata says that the correct answers are (b) flush and (c) write.

I would just like to confirm that this is correct. (b) I understand, but (c) I find a little bit more dubious.

The API for RequestDispatcher says that an IllegalStateException will be thrown "if the response was already committed". I would not think that a write would result in a commit. Or is the commit non-deterministic? Is that why the question says "can *often* lead to an IllegalStateException", rather than "*will* lead to an IllegalStateException"? Might the stream autoflush?

 
Sergio Tridente
Ranch Hand
Posts: 329
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with you. For me it is strange to talk about write() in that context. In the ServletResponse API for the getOutputStream method the javadoc specifies:

Calling flush() on the ServletOutputStream commits the response.


It does not talk about the write method on ServletOutputStream.
[ March 29, 2007: Message edited by: Sergio Tridente ]
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does this help?
 
David Bates
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I conclude that the important word in the question is can. I hate questions like this. I've got the exam in a couple of days and I seem to spend all my time asking "What do they really mean by this question? Do they want me to be clever or not?"

Multiple choice limits my choices!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic