DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10227>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10227

RequestProcessor doesn't uncast the Request properly

           Summary: RequestProcessor doesn't uncast the Request properly
           Product: Struts
           Version: 1.1 Beta 1
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: File Upload
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When a form's enctype="multipart/form-data", Struts automatically wraps the 
request into a MultipartRequestWrapper.  However, in Struts 1.1 Beta 1, it 
doesn't unwrap it before passing along to the forward.  This breaks the app 
server (JRun 4.0 in my testing).  

I found working code in Struts 1.0 and patched it into the process(request, 
response) method of RequestProcessor.  My diff -u report follows.

Thanks,

Doug

----------------------------------

--- RequestProcessor.java.orig  Tue Jun 25 14:39:32 2002
+++ RequestProcessor.java       Tue Jun 25 14:39:29 2002
@@ -141,7 +141,7 @@
      */
     protected Log log = LogFactory.getLog(this.getClass());
 
-    
+
     /**
      * The controller servlet we are associated with.
      */
@@ -265,6 +265,12 @@
             processActionPerform(request, response,
                                  action, form, mapping);
 
+        //set the request back to it's normal state if it's currently wrapped,
+        //to avoid ClassCastExceptions from ServletContainers if forwarding
+        if (request instanceof MultipartRequestWrapper) {
+            request = ((MultipartRequestWrapper) request).getRequest();
+        }
+
         // Process the returned ActionForward instance
         processActionForward(request, response, forward);

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

Reply via email to