File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes partial response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "partial response" Watch "partial response" New topic

partial response

sitaram irrinki
Ranch Hand

Joined: Feb 16, 2005
Posts: 158
when i am forwarding a request to another servlet or jsp i am not getting the partial response generated by the first servlet..whathappens exactly tothe already generated response ..will it be over ridden by the second servlet or will it be ignoredby the container
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

The initial response is written to a buffer. If the buffer fills it gets sent as is considered 'committed', if you farward after his point you gaet an IllegalStateException. If you forward before the buffer fills the buffer gets cleared (ie deleted) and starts from scratch.

In general it is a bad idea to rely on the buffer to manage this behaviour. It is better to decide whether to show A or B and only show that resource, rather than showing one and then changing your mind, hoping it won't fail horribly.
I agree. Here's the link:
subject: partial response
It's not a secret anymore!