In my camel route i am trying to get file object.
rest("/file")
.post("/extract")
.to("direct:extract");
from("direct:extract")
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
File file = exchange.getIn().getBody(File.class);
LOG.info("file : "+file);
multipartEntityBuilder.addPart("file", new FileBody(file, ContentType.MULTIPART_FORM_DATA,filename));
}
})
Here from rest i'm sending file, in processor when i tried to get through exchange getBody i'm getting as null. But same thing if i try to fetch Inputstream and byte[] means its working fine.
byte[] bytes = exchange.getIn().getBody(byte[].class);
LOG.info("bytes : "+bytes);
InputStream is = exchange.getIn().getBody(InputStream.class);
my goal is to fetch file object from exchange getBody ,is any thing wrong please let me know.