On 1/23/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:
> Here comes my unhelpful response for the day...
>

Let's try to be a bit more helpful here :-).

> [EMAIL PROTECTED] wrote:
> >
> > I've got the thing to work returning null as my forward.  That leaves a
> couple of questions though.
> >
> > 1) Does struts write anything to the response before calling you action
> class?
>
> I don't think so.
>

The only thing Struts itself might do is try to set the no-cache
headers if you have them configured.  It does not, by itself, ever
write to the response stream or response print writer.  That's the
responsibility of whatever your action forwards to.

> > 2) Does calling flush() on the response output stream cause the response
> to be sent? I kind of think it doesn't, but what exactly does flush() do in
> this instance.
>
> I don't think so.

Calling flush() doesn't necessarily cause the *entire* response to be
sent, because you might still be creating more output.  But it *does*
cause the HTTP headers, and any output content you've written to be
transmitted.  From the perspective of the servlet API, this response
has now been "committed" so you cannot later decide to do a redirect
or forward.

In general, the only use case I can think of for calling flush()
yourself is if you have something like a "Request In Progress - Please
Wait" at the beginning of your page, and you want that to show to the
user while a time-consuming process is performed to create the
remainder of the content.

>
> > AND
> >
> > 3)  Does struts close the response output stream for me?
>
> I don't think so.

Struts doesn't but the servlet container will, once your processing
has finished.

>
> :)
>
> On the first point, I very much doubt it... some headers may get set,
> but I don't think anything gets written outside your Action.
>
> On the second point, I looked at some code I wrote that does this and
> some of it calls flush(), some of it doesn't, and both seem to work.  I
> think it's probably a better idea to call it yourself to be safe, but it
> doesn't seem to matter.
>
> On the first point, I'm almost certain Struts wouldn't do that, but your
> container certainly may (and perhaps correctly should).
>
> Frank
>

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to