2 Replies Latest reply on Mar 15, 2007 10:04 AM by Carsten Hoehne

    s:fileUpload and Tomahawk extensionfilter

    Carsten Hoehne Master

      I do need some tomahawk components in my app(together with the required extension filter) What is the preferred configuration for this?
      I am asking because i have a problem with this combination and s:fileUpload. I searched this forum and the jira for posts describing such an incombatibility (with no success).
      Using Seam 1.2.0.Patch1

      My problem is:
      When i upload a file this leads to a little problem in the decode method from UIFileUpload

       private static final String TOMAHAWK_WRAPPER_CLASS = "org.apache.myfaces.webapp.filter.MultipartRequestWrapper";
      
       public void decode(FacesContext context)
       {
       super.decode(context);
      
       Object request = context.getExternalContext().getRequest();
      
       if (!(request instanceof MultipartRequest) &&
       request instanceof HttpServletRequestWrapper)
       {
       request = ((HttpServletRequestWrapper) request).getRequest();
       }
      
       if (!(request instanceof MultipartRequest) &&
       request.getClass().getName().equals(TOMAHAWK_WRAPPER_CLASS))
       {
      

      I have debugged this and
      the request that comes in is a MultipartRequestWrapper but also 'request instanceof HttpServletRequestWrapper' yields true.
      So the if statements have to be swapped . If not, a MultipartRequestWrapper will not be handled properly.

      My question: Is this because i have a configuration error in my web.xml or is this a real problem (and possible fixed)?
      Ciao,
      Carsten
      BTW
      My Web.xml declares the extension filter before seam filter.
      [...]
      <filter>
       <filter-name>extensionsFilter</filter-name>
       <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
       <init-param>
       <description>Set the size limit for uploaded files. Format: 10 - 10
       bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB</description>
       <param-name>uploadMaxFileSize</param-name>
       <param-value>100m</param-value>
       </init-param>
       <init-param>
       <description>Set the threshold size - files below this limit are
       stored in memory, files above this limit are stored on
       disk.
      
       Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB</description>
       <param-name>uploadThresholdSize</param-name>
       <param-value>100k</param-value>
       </init-param>
       </filter>
       <filter>
       <filter-name>Seam Filter</filter-name>
       <filter-class>org.jboss.seam.web.SeamFilter</filter-class>
       </filter>
       <!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
       <filter-mapping>
       <filter-name>extensionsFilter</filter-name>
       <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
       </filter-mapping>
       <!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages-->
       <filter-mapping>
       <filter-name>extensionsFilter</filter-name>
       <servlet-name>Faces Servlet</servlet-name>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
       </filter-mapping>
       <filter-mapping>
       <filter-name>Seam Filter</filter-name>
       <servlet-name>Faces Servlet</servlet-name>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
       </filter-mapping>
      [...]