|
@@ -1,5 +1,6 @@
|
|
package cn.com.qmth.examcloud.web.interceptor;
|
|
package cn.com.qmth.examcloud.web.interceptor;
|
|
|
|
|
|
|
|
+import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.util.JsonUtil;
|
|
import cn.com.qmth.examcloud.commons.util.JsonUtil;
|
|
import cn.com.qmth.examcloud.commons.util.ThreadLocalUtil;
|
|
import cn.com.qmth.examcloud.commons.util.ThreadLocalUtil;
|
|
import cn.com.qmth.examcloud.web.enums.HttpServletRequestAttribute;
|
|
import cn.com.qmth.examcloud.web.enums.HttpServletRequestAttribute;
|
|
@@ -75,13 +76,18 @@ public class FirstInterceptor implements HandlerInterceptor {
|
|
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
|
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
|
ApiId apiId = handlerMethod.getMethodAnnotation(ApiId.class);
|
|
ApiId apiId = handlerMethod.getMethodAnnotation(ApiId.class);
|
|
|
|
|
|
- ApiInfo apiInfo = null;
|
|
|
|
|
|
+ ApiInfo apiInfo;
|
|
if (null != apiId) {
|
|
if (null != apiId) {
|
|
apiInfo = ApiInfoHolder.getApiInfo(apiId.value());
|
|
apiInfo = ApiInfoHolder.getApiInfo(apiId.value());
|
|
} else {
|
|
} else {
|
|
apiInfo = ApiInfoHolder.getApiInfo(handlerMethod.getMethod());
|
|
apiInfo = ApiInfoHolder.getApiInfo(handlerMethod.getMethod());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (apiInfo == null) {
|
|
|
|
+ LOG.error("path:{} method:{} apiInfo is null.", path, method);
|
|
|
|
+ throw new StatusException("请求信息异常!");
|
|
|
|
+ }
|
|
|
|
+
|
|
String mapping = apiInfo.getMapping();
|
|
String mapping = apiInfo.getMapping();
|
|
request.setAttribute(HttpServletRequestAttribute.$_API_INFO.name(), apiInfo);
|
|
request.setAttribute(HttpServletRequestAttribute.$_API_INFO.name(), apiInfo);
|
|
|
|
|