发现一个很神奇的情况
@AdaptBy(type= VoidAdaptor.class)
public void test(HttpServletRequest req) {
String xmlHead = req.getParameter("xmlhead");
System.out.println(xmlHead); // 这里取不到
}
改为如下:
private static final MultipartConfigElement MULTI_PART_CONFIG = new MultipartConfigElement("/tmp");
@AdaptBy(type= VoidAdaptor.class)
public void test(HttpServletRequest req) {
req.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, MULTI_PART_CONFIG);
for (Part part : req.getParts()) {
System.out.println("-----类型名称------->"+part.getName());
System.out.println("-----类型------->"+part.getContentType());
System.out.println("-----提交的类型名称------->"+part.getSubmittedFileName());
System.out.println("----流-------->"+part.getInputStream());
}
String xmlHead = req.getParameter("xmlhead");
System.out.println(xmlHead); // 这里可以取到
}