org.springframework.web.multipart.support.AbstractMultipartHttpServletRequest Java Examples

The following examples show how to use org.springframework.web.multipart.support.AbstractMultipartHttpServletRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ParamInterceptor.java    From Aooms with Apache License 2.0 6 votes vote down vote up
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler){
    Map<String,String[]> paramMaps = request.getParameterMap();
    Map<String,Object> params = CollectionUtil.newHashMap();
    paramMaps.forEach((k,v) -> {
        params.put(k,convert(v));
    });

    // 文件上传
    if(request instanceof AbstractMultipartHttpServletRequest){
        //CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver(request.getServletContext());
        StandardMultipartHttpServletRequest multipartHttpServletRequest = (StandardMultipartHttpServletRequest)request;
        Map<String,MultipartFile> multipartFileMap = multipartHttpServletRequest.getFileMap();
        DataBoss.self().getPara().setFiles(multipartFileMap);
    }

    // 请求参数
    DataBoss.self().getPara().setData(params);
    // 路径参数
    DataBoss.self().getPara().setPathVars((Map)request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE));
    return true;
}
 
Example #2
Source File: CommonsMultipartResolver.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void cleanupMultipart(MultipartHttpServletRequest request) {
	if (!(request instanceof AbstractMultipartHttpServletRequest) ||
			((AbstractMultipartHttpServletRequest) request).isResolved()) {
		try {
			cleanupFileItems(request.getMultiFileMap());
		}
		catch (Throwable ex) {
			logger.warn("Failed to perform multipart cleanup for servlet request", ex);
		}
	}
}
 
Example #3
Source File: CommonsMultipartResolver.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public void cleanupMultipart(MultipartHttpServletRequest request) {
	if (!(request instanceof AbstractMultipartHttpServletRequest) ||
			((AbstractMultipartHttpServletRequest) request).isResolved()) {
		try {
			cleanupFileItems(request.getMultiFileMap());
		}
		catch (Throwable ex) {
			logger.warn("Failed to perform multipart cleanup for servlet request", ex);
		}
	}
}