Hi,

With Jetty based consumer it worked but no luck with servlet.  I am
executing this package as jetty:run

public void configure() throws Exception { 
//              getContext().getProperties().put("CamelJettyTempDir", "target");

// Jetty://http works file
//              from("jetty://http://0.0.0.0:9090/test";).process(new 
Processor() {
.// servlet:// does not work
                from("servlet:///test").process(new Processor() {
                        public void process(Exchange exchange) throws Exception 
{

                                Message in = exchange.getIn();
                                StringBuffer v = new StringBuffer();

                                v.append("\n" + in.getAttachmentNames().size() 
+ "\n");
 
                                Set<String> names = in.getAttachmentNames();
                                for (String n : names) {
                                        DataHandler h = in.getAttachment(n);
                                        v.append("\n" + h + "\n");
                                        if (h != null) {
                                                try {
                                                        int read = 0;
                                                        byte[] bytes = new 
byte[1024];
                                                        // Object o = 
h.getContent();
                                                        InputStream inputStream 
= h.getInputStream();
                                                        FileOutputStream fout = 
new FileOutputStream(
                                                                        new 
File(
                                                                                
        "/Users/navaltiger/workspace/vr.bin"));

                                                        while ((read = 
inputStream.read(bytes)) != -1) {
                                                                
fout.write(bytes, 0, read);
                                                        }
                                                        v.append("\n done \n");
                                                } catch (Exception e) {
                                                        e.printStackTrace();
                                                }
                                        }
                                }
                                exchange.getOut().setBody(v);
                        }

                }); 
        }



--
View this message in context: 
http://camel.465427.n5.nabble.com/Multipart-form-data-and-servlet-restlet-endpoint-tp5758948p5758976.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to