You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Avinash Dongre (Jira)" <ji...@apache.org> on 2021/09/13 11:30:00 UTC

[jira] [Updated] (CAMEL-16950) camel-servlet doesn't support multipart requests.

     [ https://issues.apache.org/jira/browse/CAMEL-16950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Avinash Dongre updated CAMEL-16950:
-----------------------------------
    Attachment: multipart-fix.patch
    Patch Info: Patch Available

> camel-servlet doesn't support multipart requests.
> -------------------------------------------------
>
>                 Key: CAMEL-16950
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16950
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 3.11.0
>            Reporter: Avinash Dongre
>            Priority: Major
>         Attachments: multipart-fix.patch
>
>
> [This|https://gist.github.com/avi5kdonrh/1ff3cc0e1af84e1c2c162ffe1b3852d3] test results in the following error.
> {code:java}
> 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)
> {code}
> The only workaround here is to disableĀ  auto configuration:
> camel.component.servlet.mapping.enabled=false
> And create a custom servlet auto configuration class:
> {code:java}
> @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;
>     }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)