В сообщении от 7 Март 2008 15:48 Mattias Jiderhamn написал(a):
> If I understand your question: the reason the DispatchResponse is
> committed is that you have called .flush() explicitly on the original
> HttpServletRequest (HttpResponse).
Yeah, that's what I did exactly. It would have committed it even if I didn't, 
provided I print enough text into out.

> This is nothing strange. Why could you want to create a wrapper to
> "hide" the commited state, so that you can perform forward???
> forward means "instead of"
> include means "also"
Well, the problem is that:
include is like
page <- include page
but including struts1 action is like
page <- include (forward -> forward -> forward -> forward -> page)

The problem is that resin would not let me to forward, normally, when I 
include() such chain and buffer is already committed.
This is wrong for two reasons: first, forward() in included servlet does not 
mean "instead of including page" but "instead of included page", and second, 
inclue()ing document should I guess yield same result as fetching it via HTTP 
and then pasting.

> You cannot first generate or include content, flush it to the client
> (sent over the network to the web browser) and then say "Oh wait, I
> changed my mind, I want to send this content instead" (=forward).
Nope. I've changed my mind inside included document, I want to send different 
content *to be included*.

In fact, included document should have own distinct stream which itself might 
be committed or not, can be reset and so on..
Resin cheats this for speed and thus have only one stream for both main and 
included documents.
But that breaks struts.

> If your design requires that the response is not commited, there is
> something wrong with your desing.
Sorry, can't do anything with that. Need to do actual work instead of 
rewriting struts.

> An alternative approach, if for some reason you must do it this way, is
> to create wrapper classes that put the included content in a buffer
> (think ByteArrayOutputStream) until you are sure you want to send it to
> the client, then you write the buffer to the actual response.

What about my anonymous wrapper? See reply to original post.

resin-interest mailing list

Reply via email to