commit
3ac8ce60e8
|
@ -15,19 +15,21 @@ public class MyErrorController implements ErrorController {
|
|||
|
||||
@RequestMapping(value = "/error")
|
||||
public String handleError(HttpServletRequest request) {
|
||||
|
||||
Object status = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
|
||||
|
||||
Integer statusCode =
|
||||
Integer.valueOf(request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE).toString());
|
||||
if (status != null) {
|
||||
|
||||
Integer statusCode = Integer.valueOf(status.toString());
|
||||
|
||||
if(statusCode == HttpStatus.NOT_FOUND.value()) {
|
||||
return "error-404";
|
||||
}
|
||||
else if(statusCode == HttpStatus.INTERNAL_SERVER_ERROR.value()) {
|
||||
return "error-500";
|
||||
}
|
||||
else {
|
||||
return "error";
|
||||
if(statusCode == HttpStatus.NOT_FOUND.value()) {
|
||||
return "error-404";
|
||||
}
|
||||
else if(statusCode == HttpStatus.INTERNAL_SERVER_ERROR.value()) {
|
||||
return "error-500";
|
||||
}
|
||||
}
|
||||
return "error";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Sorry we couldn't find the resource you are looking for</h1>
|
||||
<a href="/">Go Home</a>
|
||||
<div class="container">
|
||||
<div class="jumbotron" >
|
||||
<h1 class="text-center"><i class="fa fa-frown-o"> </i> Sorry, we couldn't find the page you were looking for. </h1>
|
||||
<p class="text-center"><a class="btn btn-primary" href="/"><i class="fa fa-home"></i>Go Home</a></p>
|
||||
</div></div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
|
@ -1,7 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Oops! We spilled something but we're fixing it</h1>
|
||||
<a href="/">Go Home</a>
|
||||
<div class="container">
|
||||
<div class="jumbotron" >
|
||||
<h1 class="text-center"><i class="fa fa-frown-o"> </i> Sorry, something went wrong! </h1>
|
||||
|
||||
<h2 class="text-center">We're fixing it.</h2>
|
||||
<p class="text-center"><a class="btn btn-primary" href="/"><i class="fa fa-home"></i>Go Home</a></p>
|
||||
</div></div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
|
@ -1,7 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Something went wrong! Our Engineers are on it temp</h1>
|
||||
<a href="/">Go Home</a>
|
||||
<div class="container">
|
||||
<div class="jumbotron" >
|
||||
<h1 class="text-center"><i class="fa fa-frown-o"> </i> Something went wrong! </h1>
|
||||
|
||||
<h2 class="text-center">Our Engineers are on it.</h2>
|
||||
<p class="text-center"><a class="btn btn-primary" href="/"><i class="fa fa-home"></i>Go Home</a></p>
|
||||
</div></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<h1>Welcome Home</h1>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue