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
820b4407
authored
Jan 20, 2018
by
xuxueli
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
国际化定制
parent
7a362378
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
14 deletions
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java
xxl-job-admin/src/main/webapp/500.html
xxl-job-admin/src/main/webapp/WEB-INF/template/common/common.result.ftl
xxl-job-admin/src/main/webapp/WEB-INF/template/help.ftl
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java
View file @
820b4407
...
@@ -11,6 +11,7 @@ import org.springframework.web.servlet.ModelAndView;
...
@@ -11,6 +11,7 @@ import org.springframework.web.servlet.ModelAndView;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
/**
/**
* common exception resolver
* common exception resolver
...
@@ -23,19 +24,34 @@ public class WebExceptionResolver implements HandlerExceptionResolver {
...
@@ -23,19 +24,34 @@ public class WebExceptionResolver implements HandlerExceptionResolver {
public
ModelAndView
resolveException
(
HttpServletRequest
request
,
public
ModelAndView
resolveException
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
Exception
ex
)
{
HttpServletResponse
response
,
Object
handler
,
Exception
ex
)
{
logger
.
error
(
"WebExceptionResolver:{}"
,
ex
);
logger
.
error
(
"WebExceptionResolver:{}"
,
ex
);
ModelAndView
mv
=
new
ModelAndView
();
// if json
boolean
isJson
=
false
;
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"
);
isJson
=
true
;
mv
.
addObject
(
"result"
,
JacksonUtil
.
writeValueAsString
(
new
ReturnT
<
String
>(
500
,
ex
.
toString
().
replaceAll
(
"\n"
,
"<br/>"
))));
}
mv
.
setViewName
(
"/common/common.result"
);
// error result
ReturnT
<
String
>
errorResult
=
new
ReturnT
<
String
>(
ReturnT
.
FAIL_CODE
,
ex
.
toString
().
replaceAll
(
"\n"
,
"<br/>"
));
// response
ModelAndView
mv
=
new
ModelAndView
();
if
(
isJson
)
{
try
{
response
.
setContentType
(
"application/json;charset=utf-8"
);
response
.
getWriter
().
print
(
JacksonUtil
.
writeValueAsString
(
errorResult
));
}
catch
(
IOException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
return
mv
;
}
else
{
}
else
{
mv
.
addObject
(
"exceptionMsg"
,
ex
.
toString
().
replaceAll
(
"\n"
,
"<br/>"
));
mv
.
addObject
(
"exceptionMsg"
,
errorResult
.
getMsg
());
mv
.
setViewName
(
"/common/common.exception"
);
mv
.
setViewName
(
"/common/common.exception"
);
return
mv
;
}
}
return
mv
;
}
}
}
}
\ No newline at end of file
xxl-job-admin/src/main/webapp/500.html
View file @
820b4407
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<html>
<html>
<head>
<head>
<meta
charset=
"UTF-8"
>
<meta
charset=
"UTF-8"
>
<title>
应用程序异常 (500)
</title>
<title>
Error
</title>
<style
type=
"text/css"
>
<style
type=
"text/css"
>
body
{
background-color
:
#fff
;
color
:
#666
;
text-align
:
center
;
font-family
:
arial
,
sans-serif
;
}
body
{
background-color
:
#fff
;
color
:
#666
;
text-align
:
center
;
font-family
:
arial
,
sans-serif
;
}
div
.dialog
{
div
.dialog
{
...
@@ -21,8 +21,9 @@
...
@@ -21,8 +21,9 @@
<body>
<body>
<div
class=
"dialog"
>
<div
class=
"dialog"
>
<h1>
应用程序异常
</h1>
<h1>
System Error
</h1>
<p>
抱歉!您访问的页面出现异常,请稍后重试或联系管理员。
</p>
<p>
Oops! Page not found.
</p>
<a
href=
"javascript:window.location.href='${request.contextPath}/'"
>
Back
</a>
</div>
</div>
</body>
</body>
...
...
xxl-job-admin/src/main/webapp/WEB-INF/template/common/common.result.ftl
deleted
100644 → 0
View file @
7a362378
${result?if_exists}
\ No newline at end of file
xxl-job-admin/src/main/webapp/WEB-INF/template/help.ftl
View file @
820b4407
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
<h4>
${I18n.admin_name_full}
</h4>
<h4>
${I18n.admin_name_full}
</h4>
<br>
<br>
<p>
<p>
<a
target=
"_blank"
href=
"https://github.com/xuxueli/xxl-job"
>
g
ithub
</a>
<a
target=
"_blank"
href=
"https://github.com/xuxueli/xxl-job"
>
G
ithub
</a>
<iframe
src=
"https://ghbtns.com/github-btn.html?user=xuxueli&repo=xxl-job&type=star&count=true"
frameborder=
"0"
scrolling=
"0"
width=
"170px"
height=
"20px"
style=
"margin-bottom:-5px;"
></iframe>
<iframe
src=
"https://ghbtns.com/github-btn.html?user=xuxueli&repo=xxl-job&type=star&count=true"
frameborder=
"0"
scrolling=
"0"
width=
"170px"
height=
"20px"
style=
"margin-bottom:-5px;"
></iframe>
<br><br>
<br><br>
<a
target=
"_blank"
href=
"http://www.xuxueli.com/xxl-job/"
>
${I18n.job_help_document}
</a>
<a
target=
"_blank"
href=
"http://www.xuxueli.com/xxl-job/"
>
${I18n.job_help_document}
</a>
...
...
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