This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is forward can call after response generation

 
balakrishna nannaka
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if forward or request dispatcher can call after generating some respone in the servlet which is called
 
Harpreet Hira
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by generating some response?
You can forward a request to another resource, if you have NOT committed(flushed) response to the browser.

You must be thinking how "committing a response" is different from "generating some response" ?
Generally we take a PrintWriter(out) from response and do out.println() to write something to response. This is NOT committing the response. The response is committed either on calling flush() explicitly, or when the response size increases the buffer size(8KB is default buffer size) or when you service() method completes execution and control goes back to Servlet Container.

So, in a nutshell, if you have NOT flushed the data in a servlet or JSP and NOT exceeded the buffer size you can forward the request to some other resource in the same context.
 
dema rogatkin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's possible if chunked transmission used.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic