Thanks for your input , Stephane Does that mean mimemultipart/ form-data is not a recommended solution to be used in camel integration ?
Sent from Weiquan > On Mar 31, 2021, at 1:36 AM, Siano, Stephan <stephan.si...@sap.com> wrote: > > Hi, > > when I developed the mime multipart data type I didn't have the > multipart/form-data content-type in mind, more types like multipart/related > or multipart/mixed that are much closer to the model how camel treats data > (with a payload and potentially multiple attachments). > > I am also unsure what would be a reasonable way to convert a > multipart/form-data into a camel message. Theoretically it would be possible > to provide the name of the first part of the multipart as a camel header, but > for me that would still feel rather weird (you then decompose your form data > into a camel message with the first parameter as the payload and the > parameter name in a header and all other parameters as attachments with the > parameter name as the attachment name and the parameter value as the > attachment body). Maybe it's better to decompose them into a message with an > empty payload and the parameter names as headers, but I am also not sure > whether this Is really a good idea. > > Best regards > Stephan > > -----Original Message----- > From: Claus Ibsen <claus.ib...@gmail.com> > Sent: Mittwoch, 31. März 2021 07:10 > To: users@camel.apache.org > Subject: Re: MimeMultipartDataFormat > > Hi > > A good idea is to check the unit tests of the camel component you use, > as they can help how to do stuff. > > The doc page is welcome to be updated if you find a way. To edit the > page, click the button in the bottom. > >> On Tue, Mar 30, 2021 at 8:29 PM WEIQUAN YUAN <weiquan.y...@gmail.com> wrote: >> >> Just tried to send a form with couple of fields inside to the rest endpoint >> >> ----------------------------- >> FieldName | FieldValue >> ------------------------------ >> abc | 133 >> bcd | 245 >> --------------------------------- >> from("restendpoint") >> .unmarshall().mimeMultipart() >> .process(processBean) >> ..... >> >> in the processBean, I know that the first field "abc" will be converted as >> body in the message, and the 2nd field "bcd" converted to Attachment. >> Here is my question >> >> 1. For first field, I can get FieldValue 133, but I lost the fieldName, how >> can get the fieldName in this approach? >> >> 2. for 2nd field, how can I get the fieldName and fieldValue? >> >> Do we have any good example to parse the formdata in camel mimeMultipart? >> >> Thanks > > > > -- > Claus Ibsen > ----------------- > http://davsclaus.com @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2