camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From navaltiger <vijay.ra...@gmail.com>
Subject Multipart form data and servlet/restlet endpoint
Date Wed, 12 Nov 2014 04:21:48 GMT
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.

Mime
View raw message