• Post Reply Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher.forward() clarification.  RSS feed

 
Ken Pelletier
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Sybex book "Java 2 Web Developer Certification Study Guide" states that the forward() method is a "blocking call", and that it will not return unless the target servlet writes to the responses PrintWriter.
Is it me, or does this just seem like a silly claim?
It's mentioned in several places, though, and reinforced in the sample exam questions.
It would appear that whether the target servlet writes anything or not has nothing to do with whether the forward() method call returns. Sure, the browser may hang waiting on a socket read, but that's another matter entirely; the forward() returns and the any code after it on up to the top of the stack executes to the completion of request service.
What on earth could all of that detailed discussion about forward() 'blocking' until a response is 'committed' be talking about?
That book has been described in an online review as 'bordering on fraud', and 'a profreading nightmare' in another.
I have to agree, it's absolutely the worst book I've read on a technical topic. The errata page is approaching the size of the book itself, but this particular one isn't mentioned ... yet.
 
BJ Grau
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I was studying for the SCWCD this point never came up and it was not on the test.
I just tried it out though, and it does block until the called servlet is done executing, but it doesn't appear to matter whether or not the called servlet writes to out.
 
Ken Pelletier
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, it's clear that it returns when the servlet's service method completes, but that business about blocking "until the target servlet commits its response" is the key - that's obviously not a condition of the service method's completion.
Thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!