Camel saves full http request but I want only atta

2019-03-05 06:31发布

问题:

I have the following code base:

@Component
public class DummyRoute extends RouteBuilder {
    @Override
    public void configure() throws Exception {

        rest("/upload").post().to("file://rest_files");
    }

    @Bean
    public ServletRegistrationBean servletRegistrationBean() {
        SpringServerServlet serverServlet = new SpringServerServlet();
        ServletRegistrationBean regBean = new ServletRegistrationBean( serverServlet, "/rest/*");
        Map<String,String> params = new HashMap<>();
        params.put("org.restlet.component", "restletComponent");
        regBean.setInitParameters(params);
        return regBean;
    }


    @Bean
    public org.restlet.Component restletComponent() {
        return new org.restlet.Component();
    }

    @Bean
    public RestletComponent restletComponentService() {
        return new RestletComponent(restletComponent());
    }

}

I upload file using postman:

It is actually usual csv.

But when I open file my application stored - I see file with following content:

Obvious that file contains full request information.

How can I save only file without other data from http request?

P.S.

I tried to register callback:

 @Override
 public void process(Exchange exchange) throws Exception {
     System.out.println(exchange);
     final MultipartFile mandatoryBody = exchange.getIn().getBody(MultipartFile.class);

but it returns null