Reply To: Exception in HttpRewriteWrappedRequest

Splash Forums Rewrite Users Exception in HttpRewriteWrappedRequest Reply To: Exception in HttpRewriteWrappedRequest

#25996

This seems to be related to the file upload issue people seem to run into recently…

IMHO the problem is that calling HttpServletRequest.getParameter*() for multipart requests is only allowed from Servlets that have been configured for multipart requests (Using @MultipartConfig for example). As Rewrite operates from a Servlet filter, the behavior of calling the getParameter*() methods is unspecified.

In Tomcat calling getParameter*() for a multipart request from a filter won’t return the correct result unless you set allowCasualMultipartParsing for the context.

From the Tomcat docs:

Set to true if Tomcat should automatically parse multipart/form-data request bodies when HttpServletRequest.getPart* or HttpServletRequest.getParameter* is called, even when the target servlet isn’t marked with the @MultipartConfig annotation (See Servlet Specification 3.0, Section 3.2 for details). Note that any setting other than false causes Tomcat to behave in a way that is not technically spec-compliant. The default is false

References:

http://ocpsoft.org/rewrite/docs/faq
http://tomcat.apache.org/tomcat-7.0-doc/config/context.html
http://stackoverflow.com/a/8050589/395181