You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bernard Ligny <be...@gmail.com> on 2013/07/10 15:18:18 UTC
How to split a multipart http request ?
I have an http endpoint consuming a *multipart* request, and I would like to
split the corresponding camel message in order to get a list of InputStream
with the different "parts".
I tried the following:
But I do receive the "raw" multipart body.
Is there an *easy* way to split it, without the burden of parsing this
multipart character stream ?
Or a special annotation (other than @Body) we could use ?
(NB: More or less what CXF is doing with:
public Response myService(MultipartBody body) {
=> InputStream of piece#1 =
body.getAllAttachments().get(0).getDataHandler().getInputStream()
}
)
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-split-a-multipart-http-request-tp5735438.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to split a multipart http request ?
Posted by Bernard Ligny <be...@gmail.com>.
In a servlet 3.0 environment, I could exploit the getParts() method on the
servlet request:
http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getParts()
and do the split like this:
But, unfortunately, I'm stuck to servlet 2.5 :-(
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-split-a-multipart-http-request-tp5735438p5735439.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to split a multipart http request ?
Posted by Bernard Ligny <be...@gmail.com>.
Ok i found a solution
1) enable multipart filter on the endpoint
2) use @Attachments annotation
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-split-a-multipart-http-request-tp5735438p5735457.html
Sent from the Camel - Users mailing list archive at Nabble.com.