Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-17336

camel-servlet-starter doesn't support multipart requests

XMLWordPrintable

    • Icon: Feature Feature
    • Resolution: Done
    • Icon: Minor Minor
    • fuse-7.10-GA
    • fuse-7.7-GA
    • Camel

      This test results in the following error.

      java.lang.IllegalStateException: UT010057: multipart config was not present on Servlet
      	at io.undertow.servlet.spec.HttpServletRequestImpl.verifyMultipartServlet(HttpServletRequestImpl.java:541)
      	at io.undertow.servlet.spec.HttpServletRequestImpl.getPart(HttpServletRequestImpl.java:547)
      	at org.apache.camel.component.servlet.springboot.test.ServletMultiPartTest$1.lambda$configure$0(ServletMultiPartTest.java:63)
      	at org.apache.camel.support.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:66)
      	at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:469)
      	at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:179)
      	at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:64)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:184)
      

      The only workaround here is to disable default auto configuration:

      camel.component.servlet.mapping.enabled=false

      And create a custom servlet auto configuration class:

      @Configuration
      @EnableConfigurationProperties(ServletMappingConfiguration.class)
      public class CustomAutoConfiguration {
      
          @Bean
          ServletRegistrationBean servletRegistrationBean(ServletMappingConfiguration config) {
              ServletRegistrationBean mapping = new ServletRegistrationBean();
              mapping.setServlet(new CamelHttpTransportServlet());
              mapping.addUrlMappings(config.getContextPath());
              mapping.setName(config.getServletName());
              mapping.setLoadOnStartup(1);
              mapping.setMultipartConfig(new MultipartConfigElement("/tmp"));
      
              return mapping;
          }
      
      }
      
      

              ldemasi Luigi De Masi
              rhn-support-adongre Avinash Dongre
              Federico Mariani Federico Mariani
              Roman Stepaniuk
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: