|
@@ -1,7 +1,6 @@
|
|
package cn.com.qmth.examcloud.web.support;
|
|
package cn.com.qmth.examcloud.web.support;
|
|
|
|
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
-import java.util.List;
|
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -15,13 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
|
-import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
|
|
|
|
|
|
-import cn.com.qmth.examcloud.api.commons.CloudService;
|
|
|
|
import cn.com.qmth.examcloud.api.commons.exchange.BaseResponse;
|
|
import cn.com.qmth.examcloud.api.commons.exchange.BaseResponse;
|
|
-import cn.com.qmth.examcloud.api.commons.exchange.FormFilePart;
|
|
|
|
-import cn.com.qmth.examcloud.api.commons.exchange.FormRequest;
|
|
|
|
import cn.com.qmth.examcloud.api.commons.exchange.JsonSerializable;
|
|
import cn.com.qmth.examcloud.api.commons.exchange.JsonSerializable;
|
|
import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
|
|
import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
|
|
import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
|
|
import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
|
|
@@ -135,10 +129,6 @@ public class ControllerAspect {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (isRpcRequest(request)) {
|
|
|
|
- processFormFileParts(request, args);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
Object ret = null;
|
|
Object ret = null;
|
|
try {
|
|
try {
|
|
if (null != httpMethodProcessor) {
|
|
if (null != httpMethodProcessor) {
|
|
@@ -242,46 +232,4 @@ public class ControllerAspect {
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 处理表单请求中的文件
|
|
|
|
- *
|
|
|
|
- * @author WANGWEI
|
|
|
|
- * @param request
|
|
|
|
- * @param args
|
|
|
|
- */
|
|
|
|
- private void processFormFileParts(HttpServletRequest request, Object[] args) {
|
|
|
|
- for (int i = 0; i < args.length; i++) {
|
|
|
|
- Object curArg = args[i];
|
|
|
|
- if (curArg instanceof FormRequest) {
|
|
|
|
- FormRequest formReq = (FormRequest) curArg;
|
|
|
|
- List<FormFilePart> formFilePartList = formReq.getFormFilePartList();
|
|
|
|
- if (null == formFilePartList) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
|
|
|
- for (FormFilePart formFilePart : formFilePartList) {
|
|
|
|
- MultipartFile file = multipartRequest.getFile(formFilePart.getParamName());
|
|
|
|
- System.out.println(file);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 是否是RPC
|
|
|
|
- *
|
|
|
|
- * @author WANGWEI
|
|
|
|
- * @param request
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- private boolean isRpcRequest(HttpServletRequest request) {
|
|
|
|
- ApiInfo apiInfo = (ApiInfo) request
|
|
|
|
- .getAttribute(HttpServletRequestAttribute.$_API_INFO.name());
|
|
|
|
- if (null == apiInfo) {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- Class<?> ctrClass = apiInfo.getBeanType();
|
|
|
|
- return CloudService.class.isAssignableFrom(ctrClass);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|