cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Engelhart <>
Subject Re: RequestDispatcher &
Date Wed, 02 Feb 2000 03:54:37 GMT
Stefano Mazzocchi wrote:

> Mike Engelhart wrote:
>> OK - I've been digging through Cocoon source code and I think what is needed
>> is the ability to determine if a RequestDispatcher has been created with the
>> HttpServletRequest.getRequestDispatcher() or
>> ServletContext.getRequestDispatcher() method calls.  If so then I want to
>> skip over the code in the Engine.handle() that gets a PrintWriter and writes
>> out to it.   What I'm struggling with is how to determine if a
>> RequestDispatcher has been created.  I've been looking at the jsdk 2.2 api
>> for the last hour and can't find anything way to determine this.  Anyone
>> have any idea how to find this out?
> What about doing a try-catch around getWriter()? if an illegalstate is
> caught, we skip it over.
> What do you think?

OK - first attempt at this works.  I'm not 100% confident that this fix is
the answer to our problems though.  Can anyone else with more JSDK internals
experience determine if this is dangerous...Stefano??  For all I know this
could be fine.

Anyway here's the change needed to to allow the
HttpServletRequest.getRequestDispatcher(String uri) to be called from within
an XSP or presumably any Producer.

// get the output writer
PrintWriter out = null;
    out = response.getWriter();
catch(IllegalStateException e)
    // we don't want to write to this or cache the document since
    // presumably it is not complete so lets return
   // from this call to handle()

I'll continue to test this as my application requires this functionality
(RequestDispatcher that is).   If we can ensure that this is safe to add,
lets get this into Cocoon before the next minor/major release so we can
fully support the JSDK for those using a 2.2 compliant servlet engine.


View raw message