Skip to content

Commit

Permalink
update: 将前后台404/403/505 错误页严格区分
Browse files Browse the repository at this point in the history
  • Loading branch information
Wizzercn committed Jul 27, 2019
1 parent 3484e4a commit 9e75e5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques
response.getWriter().write(Json.toJson(new NutMap("code", "-1").setv("msg", response.getStatus() + " error")));
return;
} else {
request.setAttribute("original_request_uri", request.getRequestURI());
RequestDispatcher rd = request.getRequestDispatcher("/platform/home/" + response.getStatus());
rd.forward(request, response);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ public void path(@Param("url") String url, HttpServletRequest req) {

@At("/403")
@Ok("re")
public Object error403() {
if (shiroUtil.isAuthenticated()) {
public Object error403(HttpServletRequest req) {
if (Strings.sNull(req.getAttribute("original_request_uri")).startsWith("/platform") && shiroUtil.isAuthenticated()) {
return "beetl:/platform/sys/403.html";
} else {
return ">>:/error/404.html";
Expand All @@ -126,8 +126,8 @@ public Object error403() {

@At("/404")
@Ok("re")
public Object error404() {
if (shiroUtil.isAuthenticated()) {
public Object error404(HttpServletRequest req) {
if (Strings.sNull(req.getAttribute("original_request_uri")).startsWith("/platform") && shiroUtil.isAuthenticated()) {
return "beetl:/platform/sys/404.html";
} else {
return ">>:/error/404.html";
Expand All @@ -136,8 +136,8 @@ public Object error404() {

@At("/500")
@Ok("re")
public Object error500() {
if (shiroUtil.isAuthenticated()) {
public Object error500(HttpServletRequest req) {
if (Strings.sNull(req.getAttribute("original_request_uri")).startsWith("/platform") && shiroUtil.isAuthenticated()) {
return "beetl:/platform/sys/500.html";
} else {
return ">>:/error/500.html";
Expand Down

0 comments on commit 9e75e5d

Please sign in to comment.