java - Multipart, spring-boot and JBoss - Required request part 'file' is not present -


i have application uses spring-boot , embedded tomcat development, , on production server deployed on jboss 6.4 eap. after adding support jboss, multipart file upload stopped working. on both containers throwing missingservletrequestpartexception.

adding multipartconfigelement servletregistrationbean fixed issue on tomcat, jboss it's still not working. have ideas problem?

configuration:

@bean public servletregistrationbean dispatcherregistration(dispatcherservlet dispatcherservlet, multipartconfigelement         multipartconfig) {     servletregistrationbean registration = new servletregistrationbean(dispatcherservlet);     registration.geturlmappings().clear();     registration.addurlmappings("/*");     registration.setmultipartconfig(multipartconfig);     return registration; } 

endpoint:

@requestmapping(method = post) @responsebody public someresponse uploadfilewithcomment(     @requestparam(value = "file") final multipartfile file,     @requestparam(value = "comment") string comment) {     ... } 

web.xml

<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"          xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">     <listener>         <listener-class>org.springframework.web.context.request.requestcontextlistener</listener-class>     </listener>      <servlet>         <servlet-name>restservlet</servlet-name>         <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class>         <init-param>             <param-name>contextconfiglocation</param-name>             <param-value>com.rebelek.application</param-value>         </init-param>         <init-param>             <param-name>contextclass</param-name>             <param-value>                 org.springframework.web.context.support.annotationconfigwebapplicationcontext             </param-value>         </init-param>         <load-on-startup>1</load-on-startup>     </servlet>     <servlet-mapping>         <servlet-name>restservlet</servlet-name>         <url-pattern>/*</url-pattern>     </servlet-mapping>     <filter>         <filter-name>springsecurityfilterchain</filter-name>         <filter-class>org.springframework.web.filter.delegatingfilterproxy</filter-class>     </filter>      <filter-mapping>         <filter-name>springsecurityfilterchain</filter-name>         <url-pattern>/*</url-pattern>     </filter-mapping> </web-app> 


Comments

Popular posts from this blog

javascript - WinJS appendTextAsync producing scheduler errors -

minify - Minimizing css files -

Sockets with kotlin -