From c183c51733dcd12104ce31bf09356ccb6c7a912e Mon Sep 17 00:00:00 2001 From: Lemonochrme Date: Mon, 25 Nov 2024 16:29:40 +0100 Subject: [PATCH] Added error controller --- helpapp/pom.xml | 6 ++++++ .../helpapp/CustomErrorController.java | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 helpapp/src/main/java/insa/application/helpapp/CustomErrorController.java diff --git a/helpapp/pom.xml b/helpapp/pom.xml index 1565f6b..d16cec9 100644 --- a/helpapp/pom.xml +++ b/helpapp/pom.xml @@ -45,6 +45,12 @@ spring-boot-starter-test test + + + org.apache.cxf + cxf-spring-boot-starter-jaxws + 3.5.0 + diff --git a/helpapp/src/main/java/insa/application/helpapp/CustomErrorController.java b/helpapp/src/main/java/insa/application/helpapp/CustomErrorController.java new file mode 100644 index 0000000..32f0f72 --- /dev/null +++ b/helpapp/src/main/java/insa/application/helpapp/CustomErrorController.java @@ -0,0 +1,17 @@ +package insa.application.helpapp; + +import org.springframework.boot.web.servlet.error.ErrorController; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class CustomErrorController implements ErrorController { + + @RequestMapping("/error") + @ResponseBody + public String handleError() { + // Return the inline HTML content for the custom error page + return "Error

Something went wrong!

We are sorry, but the page you are looking for does not exist.

Error Image"; + } +} \ No newline at end of file