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