Added error controller

This commit is contained in:
Lemonochrme 2024-11-25 16:29:40 +01:00
parent 1f9ec0bf9d
commit c183c51733
2 changed files with 23 additions and 0 deletions

View file

@ -45,6 +45,12 @@
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.5.0</version>
</dependency>
</dependencies> </dependencies>

View file

@ -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 "<html><head><title>Error</title></head><body><h1>Something went wrong!</h1><p>We are sorry, but the page you are looking for does not exist.</p><img src='https://i.ytimg.com/vi/lqvcsjvBFQA/sddefault.jpg' alt='Error Image'></body></html>";
}
}