In a spring-boot camel application I want to consume http file uploads. In my application.properties I bypass Spring Boot's MultipartResolver and let Camel handle the multipart data directly: *spring.servlet.multipart.enabled=false*
I am using this curl command to upload 2 simple text files: *curl --location --request POST 'localhost:8080/send/data' \--form 'form-field-1=@"a.txt"' --form 'form-field-2=@"b.txt"' \--verbose* ``` @Override public void configure() throws Exception { // Define REST configuration restConfiguration() .component("platform-http") .port(8080) .bindingMode(RestBindingMode.off) .dataFormatProperty("multipart", "true"); // Define POST endpoint for uploading files rest("/send") .post("/data") .consumes("multipart/form-data") .to("direct:processFiles"); from("direct:processFiles") .log("Receiving file(s)...") // .unmarshal().mimeMultipart() .setHeader("CamelFileName", constant("newfile.txt")) .to("stream:out") // .to("file:" + inputDirectory) .log("Upload process complete."); } ``` With the above route I get following console output: *--------------------------cMowx5JcRMRWFrVR7Tx5VaContent-Disposition: form-data; name="form-field-1"; filename="a.txt"Content-Type: text/plainI am the content of file a!--------------------------cMowx5JcRMRWFrVR7Tx5VaContent-Disposition: form-data; name="form-field-2"; filename="b.txt"Content-Type: text/plainI am the content of file b!--------------------------cMowx5JcRMRWFrVR7Tx5Va--* 1. I found many resources talking about attachments: Map<String, DataHandler> attachments = exchange.getIn(AttachmentMessage.class).getAttachments() I used curl and postman, but my request has no attachments 2. Is it the correct Camel way to bypass Spring Boot's MultipartResolver or should I look into using Tomcats way to handle multipart/form-data? 3. Is there any easy way to parse the multipart/form-data request bodies in Camel. I tried ".unmarshal().mimeMultipart()", but this throws following exception: No type converter available to convert from type: org.apache.camel.converter.stream.ReaderCache to the required type: java.io.InputStream Thanks