Hi Jari,

I have followed your exchange of messages with Bob with interest. I just
wanted to let you know that I have fixe bug 1612 in CVS (it will be released
tomorrow with the official bugfix release of Cactus 1.1). Let me know if
this helps for your test or if you still have problems.

Thanks
Vincent.

----- Original Message -----
From: "Jari Worsley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 11, 2001 2:19 PM
Subject: [cactus] getRequestDispatcher bug and fix


> Ok,
>
> I have been playing about with cactus for the last few days, and am
> hitting problems trying to test servlets that forward or include another
> resource.
>
> Specifically when trying to test a "action" type servlet ("Model 2
> stylee") that forwards to a JSP.
>
> I am getting a ClassCastException and I think the following is the
> problem:
>
> in the servlet i have the following line of code:
>
> request.getRequestDispatcher(somePageIdentifier).forward(request,
> response);
>
> This makes the test framework barf.
>
> Why?
> In HttpServletRequestWrapper the following call returns the ACTUAL
> requestdispatcher rather than a wrapped version.
>
>    public RequestDispatcher getRequestDispatcher(String thePath)
>     {
>         return m_Request.getRequestDispatcher(thePath);
>     }
>
> which means that the following in RequestDispatcherWrapper is never
> called:
>
>     /**
>      * Call the original <code>RequestDispatcher</code>
> <code>forward()</code>
>      * method but with the original HTTP request (not the simulation one
> which
>      * would make the servlet engine choke !).
>      *
>      * @param theRequest the simulation HTTP request
>      * @param theResponse the original HTTP response
>      */
>     public void forward(ServletRequest theRequest, ServletResponse
> theResponse) throws IOException, ServletException
>     {
>         HttpServletRequestWrapper request =
> (HttpServletRequestWrapper)theRequest;
>         m_OriginalDispatcher.forward(request.getOriginalRequest(),
> theResponse);
>     }
>
> Note the comment...
>
> I have tested the HttpServletRequestWrapper with the following:
>    public RequestDispatcher getRequestDispatcher(String thePath)
>     {
>         return new RequestDispatcherWrapper(
> m_Request.getRequestDispatcher(thePath));
>     }
>
> which seems to work and allows my original code to forward to the jsp as
> per before trying cactus.
>
> Anyone confirm this as a bug?
>
> and if so how do i get this fix submitted back into cactus?
> Do I need to do a diff to show the change or is the above enough?
>
> Jari
>
> --
> Jari Worsley
> Senior Programmer
> Hyperlink Interactive Ltd
>

Reply via email to