myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose de Castro <>
Subject ExtensionsFilter - Disable Multipart Wrapping
Date Wed, 05 Mar 2008 00:19:50 GMT

I've been a MyFaces/Tomawahk user for the last few years. For the  
longest time, it completely served my needs and was very happy with  
the level of support that I received from the community. About a year  
ago, I decided to adopt JBoss Seam and a way to augment my own  
implementation of "conversations" in JSF. All was well until I  
decided to use Seam's fielUpload component alongside the MyFaces  
ExtensionFilter. (see: 

The ExtensionFilter is great at many things but lacks modularity in  
my opinion. I shouldn't be forced to MultipartRequestWrapper in order  
to get resource streaming and content negotiation. I've attached a  
patch that allows a user to disable "Multipart Request Wrapping" via  
an init parameter while leaving the default behavior intact. I've  
been running this patch in QA for a few days and all seems well.

Does this seem like something that could eventually make it in the  
next release? If not, what would be a suitable alternative?

Please excuse me if I'm breaking protocol by in-lining a diff but I  
wasn't sure how you guys operate for these kind of things.

Thanks in advance,

Jose de castro
Sr. Software Engineer
Voxeo Corporation

Index: /Users/jdecastro/Work/Libraries/tomahawk-1.1.6-src/core/src/ 
--- /Users/jdecastro/Work/Libraries/tomahawk-1.1.6-src/core/src/main/ 
java/org/apache/myfaces/webapp/filter/	(revision  
+++ /Users/jdecastro/Work/Libraries/tomahawk-1.1.6-src/core/src/main/ 
java/org/apache/myfaces/webapp/filter/	(working  
@@ -47,6 +47,8 @@

      private String _uploadRepositoryPath = null; //standard temp  

+    private boolean _enableMultipartWrapper = true;
      private ServletContext _servletContext;

      public static final String DOFILTER_CALLED =  
@@ -66,6 +68,11 @@

          _uploadRepositoryPath = filterConfig.getInitParameter 

+        String enabledWrapperValue = filterConfig.getInitParameter 
+        if(enabledWrapperValue != null) {
+            _enableMultipartWrapper = Boolean.parseBoolean 
+        }
          _servletContext = filterConfig.getServletContext();

@@ -114,7 +121,7 @@
          HttpServletRequest extendedRequest = httpRequest;

          // For multipart/form-data requests
-        if (FileUpload.isMultipartContent(httpRequest)) {
+        if (_enableMultipartWrapper && FileUpload.isMultipartContent 
(httpRequest)) {
              extendedRequest = new MultipartRequestWrapper 
(httpRequest, _uploadMaxFileSize, _uploadThresholdSize,  

View raw message