Error page handling

version2
Tim Holloway 2 years ago
parent 8818969564
commit bc368f084c
  1. 3
      .gitignore
  2. 3
      src/main/java/com/mousetech/gourmetj/SpringPrimeFacesApplication.java
  3. 6
      src/main/resources/META-INF/resources/error/error.html
  4. 12
      src/main/resources/META-INF/resources/error/error404.html

3
.gitignore vendored

@ -0,0 +1,3 @@
target/
*~

@ -21,6 +21,7 @@ import org.springframework.http.HttpStatus;
public class SpringPrimeFacesApplication {
final String errorPage = "/error/error.html";
final String error404Page = "/error/error404.html";
public static void main(String[] args) {
SpringApplication.run(SpringPrimeFacesApplication.class,
@ -57,7 +58,7 @@ public class SpringPrimeFacesApplication {
public void registerErrorPages(
ErrorPageRegistry registry) {
registry.addErrorPages(new ErrorPage(
HttpStatus.NOT_FOUND, errorPage));
HttpStatus.NOT_FOUND, error404Page));
registry.addErrorPages(new ErrorPage(
HttpStatus.INTERNAL_SERVER_ERROR,
errorPage));

@ -1,9 +1,11 @@
<html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ERROR</title>
</head>
<body>
<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>
</html>

@ -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…
Cancel
Save