Commit 9b3baf8b authored by 高东东's avatar 高东东

*)修改登录失效返回状态

parent 658abd1e
package com.yeejoin.amos.fas.config;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ResponseBody;
......@@ -20,8 +23,9 @@ public class ExceptionHandler {
@org.springframework.web.bind.annotation.ExceptionHandler(PermissionException.class)
@ResponseBody
public CommonResponse handlePermissionException(HttpServletRequest request, PermissionException ex) {
return CommonResponseUtil.failure(ex.getMessage());
public CommonResponse handlePermissionException(HttpServletRequest request, HttpServletResponse resp, PermissionException ex) {
resp.setStatus(HttpStatus.UNAUTHORIZED.value());
return CommonResponseUtil.failure(ex.getMessage());
}
@org.springframework.web.bind.annotation.ExceptionHandler(YeeException.class)
......
......@@ -15,6 +15,6 @@ public class PermissionException extends RuntimeException{
}
public HttpStatus getStatus() {
return HttpStatus.FORBIDDEN; // 403
return HttpStatus.UNAUTHORIZED; // 401
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment