Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16950

camel-servlet-starter doesn't support multipart requests

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.11.0
    • 3.12.0
    • None
    • Patch Available
    • Unknown

    Description

      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Ā  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;
          }
      
      }
      
      

      Attachments

        1. multipart-fix.patch
          2 kB
          Avinash Dongre

        Issue Links

          Activity

            People

              Unassigned Unassigned
              avi5kdon@gmail.com Avinash Dongre
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: