Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
station
YeeAmosFireAutoSysRoot
Commits
9b3baf8b
Commit
9b3baf8b
authored
Sep 02, 2020
by
高东东
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*)修改登录失效返回状态
parent
658abd1e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
ExceptionHandler.java
...in/java/com/yeejoin/amos/fas/config/ExceptionHandler.java
+5
-1
PermissionException.java
...a/com/yeejoin/amos/fas/exception/PermissionException.java
+1
-1
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/config/ExceptionHandler.java
View file @
9b3baf8b
package
com
.
yeejoin
.
amos
.
fas
.
config
;
package
com
.
yeejoin
.
amos
.
fas
.
config
;
import
javax.servlet.ServletResponse
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
...
@@ -20,7 +23,8 @@ public class ExceptionHandler {
...
@@ -20,7 +23,8 @@ public class ExceptionHandler {
@org
.
springframework
.
web
.
bind
.
annotation
.
ExceptionHandler
(
PermissionException
.
class
)
@org
.
springframework
.
web
.
bind
.
annotation
.
ExceptionHandler
(
PermissionException
.
class
)
@ResponseBody
@ResponseBody
public
CommonResponse
handlePermissionException
(
HttpServletRequest
request
,
PermissionException
ex
)
{
public
CommonResponse
handlePermissionException
(
HttpServletRequest
request
,
HttpServletResponse
resp
,
PermissionException
ex
)
{
resp
.
setStatus
(
HttpStatus
.
UNAUTHORIZED
.
value
());
return
CommonResponseUtil
.
failure
(
ex
.
getMessage
());
return
CommonResponseUtil
.
failure
(
ex
.
getMessage
());
}
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/exception/PermissionException.java
View file @
9b3baf8b
...
@@ -15,6 +15,6 @@ public class PermissionException extends RuntimeException{
...
@@ -15,6 +15,6 @@ public class PermissionException extends RuntimeException{
}
}
public
HttpStatus
getStatus
()
{
public
HttpStatus
getStatus
()
{
return
HttpStatus
.
FORBIDDEN
;
// 403
return
HttpStatus
.
UNAUTHORIZED
;
// 401
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment