camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Multipart form data and servlet/restlet endpoint
Date Wed, 12 Nov 2014 06:03:39 GMT
Hi

Maybe see if you can find some samples in camel-servlet / camel-jetty
unit tests that deals with attachments.

And attachments would be on the Camel Message with the getAttachments method.



On Wed, Nov 12, 2014 at 5:21 AM, navaltiger <vijay.rathi@gmail.com> wrote:
> dear all,
>
> I am looking to implement a route where reslet/cxfrs end point will accept
> file as multipart request and process. (Request may have some JSON data as
> well.
>
> For sake of simplify thing and get it working with servlet first have tried
> following code.  Also tried sending file using curl. I can see file related
> info in headers and debug output, but not able to retrieve attachment. But
> no luck.
> (Additional info: I am running project as mvn jetty:run.  The package is in
> form of war and will be deployed on web logic server.  Moreover, stream
> caching is not in place.)
>
> from("servlet:///hello").process(new Processor() {
>    @Override
>    public void process(Exchange exchange) throws Exception {
>       Message in = exchange.getIn();
>       StringBuffer v = new StringBuffer();
>        HttpServletRequest request = (HttpServletRequest) in
>           .getHeaders().get(Exchange.HTTP_SERVLET_REQUEST);
>
>        DiskFileItemFactory diskFile = new DiskFileItemFactory();
>        FileItemFactory factory = diskFile;
>        ServletFileUpload upload = new ServletFileUpload(factory);
>        List items = upload.parseRequest(request);
> .....
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Multipart-form-data-and-servlet-restlet-endpoint-tp5758948.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message