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?