Browse Source

修改被顶掉code编码

songxinlu 3 years atrás
parent
commit
9332c52116

+ 4 - 3
src/main/java/com/diagbot/config/security/UrlFilterSecurityInterceptor.java

@@ -1,6 +1,7 @@
 package com.diagbot.config.security;
 
 import com.alibaba.fastjson.JSONObject;
+import com.diagbot.exception.CommonException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.SecurityMetadataSource;
 import org.springframework.security.access.intercept.AbstractSecurityInterceptor;
@@ -46,12 +47,12 @@ public class UrlFilterSecurityInterceptor extends AbstractSecurityInterceptor im
         FilterInvocation fi = new FilterInvocation(request, response, chain);
         try {
             invoke(fi);
-        }catch (Exception e)
+        }catch (CommonException e)
         {
             JSONObject error = new JSONObject();
             response.setContentType("text/html;charset=utf-8");
-            error.put("code","00000001");
-            error.put("msg",e.getMessage());
+            error.put("code",e.getCode());
+            error.put("msg", e.getMessage());
             response.getWriter().println(error);
             response.flushBuffer();
         }