Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
熊鹏飞
/
xxljob220
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c5c2d57d
authored
Aug 14, 2016
by
xueli.xue
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
异常处理器, JSON数据处理
parent
df6a1937
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java
View file @
c5c2d57d
package
com
.
xxl
.
job
.
admin
.
controller
.
resolver
;
package
com
.
xxl
.
job
.
admin
.
controller
.
resolver
;
import
javax.servlet.http.HttpServletRequest
;
import
com.xxl.job.admin.core.model.ReturnT
;
import
javax.servlet.http.HttpServletResponse
;
import
com.xxl.job.core.util.JacksonUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
...
@@ -10,8 +9,8 @@ import org.springframework.web.method.HandlerMethod;
...
@@ -10,8 +9,8 @@ import org.springframework.web.method.HandlerMethod;
import
org.springframework.web.servlet.HandlerExceptionResolver
;
import
org.springframework.web.servlet.HandlerExceptionResolver
;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.servlet.ModelAndView
;
import
com.xxl.job.admin.core.model.ReturnT
;
import
javax.servlet.http.HttpServletRequest
;
import
com.xxl.job.core.util.JacksonUtil
;
import
javax.servlet.http.HttpServletResponse
;
/**
/**
* common exception resolver
* common exception resolver
...
@@ -29,6 +28,7 @@ public class WebExceptionResolver implements HandlerExceptionResolver {
...
@@ -29,6 +28,7 @@ public class WebExceptionResolver implements HandlerExceptionResolver {
HandlerMethod
method
=
(
HandlerMethod
)
handler
;
HandlerMethod
method
=
(
HandlerMethod
)
handler
;
ResponseBody
responseBody
=
method
.
getMethodAnnotation
(
ResponseBody
.
class
);
ResponseBody
responseBody
=
method
.
getMethodAnnotation
(
ResponseBody
.
class
);
if
(
responseBody
!=
null
)
{
if
(
responseBody
!=
null
)
{
response
.
setContentType
(
"application/json;charset=UTF-8"
);
mv
.
addObject
(
"result"
,
JacksonUtil
.
writeValueAsString
(
new
ReturnT
<
String
>(
500
,
ex
.
toString
().
replaceAll
(
"\n"
,
"<br/>"
))));
mv
.
addObject
(
"result"
,
JacksonUtil
.
writeValueAsString
(
new
ReturnT
<
String
>(
500
,
ex
.
toString
().
replaceAll
(
"\n"
,
"<br/>"
))));
mv
.
setViewName
(
"/common/common.result"
);
mv
.
setViewName
(
"/common/common.result"
);
}
else
{
}
else
{
...
...
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