This problem has been fixed on the main trunk, and there is a Bugzilla bug 
report for moving it into the Struts 1.0 branch. You are correct that the 
request needs to be unwrapped. Rest assured that the fix will be in Struts 1.0!

--
Martin Cooper


At 12:36 PM 6/12/01, Chad Johnston wrote:
>Greetings,
>
>I'm not 100% sure of the protocol to follow when submitting a patch, so
>please let me know if I'm screwing this up.
>
>In ActionServlet.java, the processValidate method forwards the request back
>to the input page if validation fails. The code in question looks like this:
>
>RequestDispatcher rd = getServletContext().getRequestDispatcher(uri);
>    if (rd == null) {
>        response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
>                           internal.getMessage("requestDispatcher",
>                                               uri));
>        return (false);
>    }
>
>    rd.forward(request, response);
>    return (false);
>
>If the form is a multipart form, the process method wraps the request object
>in a MultipartRequestWrapper. This causes a ClassCastException when the
>servlet container (TomCat 3.2.2 in my case) tries to process the forward. I
>was able to work around this problem with the following change to the
>rd.forward(...) line:
>
>if (request instanceof MultipartRequestWrapper) {
>      rd.forward(((MultipartRequestWrapper)request).getRequest(),response);
>}
>else {
>     rd.forward(request, response);
>}
>
>This will assure that the servlet container will get a request object that
>is not already extended from HttpServletRequest. This cleared the problem up
>for me on TomCat - I have not been able to test the patch on any other web
>app servers.
>
>This bug could be a real show stopper for anybody that's trying to verify
>the validity of uploaded files, or additional form fields in the multipart
>form.
>
>Chad Johnston
>[EMAIL PROTECTED]


Reply via email to