Camel保存完整的http请求,但我只想附加文件
我有以下代码库:
@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 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()); } }
我使用邮递员上传文件:
它实际上是通常的csv。
但是当我打开文件存储我的应用程序时 – 我看到包含以下内容的文件:
很明显,该文件包含完整的请求信息。
如何在没有来自http请求的其他数据的情况下仅保存文件?
PS
我试着注册回调:
@Override public void process(Exchange exchange) throws Exception { System.out.println(exchange); final MultipartFile mandatoryBody = exchange.getIn().getBody(MultipartFile.class);
但它返回null