2 Replies Latest reply on Feb 4, 2013 5:29 AM by Jean-Frederic Clere

    Enable allowCasualMultipartParsing in jboss as 7

    Ståle Tomten Newbie

      Ive implemented balusc's filter for uploading files in servlet 3.0 with  multipart request.

      http://balusc.blogspot.no/2009/12/uploading-files-in-servlet-30.html

       

      In order to make this work we need to set a flag in tomcat  to enable the HttpServletRequest#getParts() method for filter classes:

      https://issues.apache.org/bugzilla/show_bug.cgi?id=49711

       

      In his example it is stated that it is needed to add the allowCasualMultipartParsing for tomcat to be able to read multipart values inside a filter class.

      So i added a context.xml with this content inside my META-INF directory:

      <Context path="" allowCasualMultipartParsing="true">

       

      When calling request.getParts() in the filter - I always get an empty list.

      So it seems that setting allowCasualMultipartParsing="true" in context.xml does not work in jboss as 7.

       

      How can i enable this tomcat flag in jboss as 7.1.3 ?

       

      (For reference: this is how it is done for tomcat: http://stackoverflow.com/questions/8047173/how-to-enable-multipart-form-data-in-tomcat-7-0-8-server)

      However making a servlet with the @MultipartConfig annotation works like a charm - but i'd like to avvoid that.

       

      Regards,

      Ståle