Error page handling
This commit is contained in:
parent
8818969564
commit
bc368f084c
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
target/
|
||||||
|
*~
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.springframework.http.HttpStatus;
|
||||||
public class SpringPrimeFacesApplication {
|
public class SpringPrimeFacesApplication {
|
||||||
|
|
||||||
final String errorPage = "/error/error.html";
|
final String errorPage = "/error/error.html";
|
||||||
|
final String error404Page = "/error/error404.html";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(SpringPrimeFacesApplication.class,
|
SpringApplication.run(SpringPrimeFacesApplication.class,
|
||||||
|
@ -57,7 +58,7 @@ public class SpringPrimeFacesApplication {
|
||||||
public void registerErrorPages(
|
public void registerErrorPages(
|
||||||
ErrorPageRegistry registry) {
|
ErrorPageRegistry registry) {
|
||||||
registry.addErrorPages(new ErrorPage(
|
registry.addErrorPages(new ErrorPage(
|
||||||
HttpStatus.NOT_FOUND, errorPage));
|
HttpStatus.NOT_FOUND, error404Page));
|
||||||
registry.addErrorPages(new ErrorPage(
|
registry.addErrorPages(new ErrorPage(
|
||||||
HttpStatus.INTERNAL_SERVER_ERROR,
|
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||||
errorPage));
|
errorPage));
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
<html>
|
<!DOCTYPE html>
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<title>ERROR</title>
|
<title>ERROR</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Uh-oh!</h1>
|
<h1>Uh-oh!</h1>
|
||||||
An error happened.
|
<p>An error happened. Check the logs.</p>
|
||||||
|
<p><a href="/main.jsf">Return to Main Page</a></p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
12
src/main/resources/META-INF/resources/error/error404.html
Normal file
12
src/main/resources/META-INF/resources/error/error404.html
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>ERROR - Page Not Found</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Page Not Found</h1>
|
||||||
|
<p>This URL is invalid.</p>
|
||||||
|
<p><a href="/main.jsf">Return to Main Page</a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user