Hi guys, i’m working on some specs in my app and i’m trying to specify a 404 error handler and 500 error handler in my PathHandler, apparently that’s not possible, i tried to use default handler as Handles.path(//MyDefaultHandlerHere), for 404 handler works fine, but what about 500 error handler ? there is any way to specify this ?
Simple test:
Undertow.builder().addHttpListener( 8080 , "localhost" )
.setHandler(path(new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
System.out.println( "DEFAULT");
}
})
.addExactPath("/hi", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
System.out.println( "HI");
}})
.addExactPath("/hi2", new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
System.out.println( "HI2");
throw new RuntimeException();
}})
).build();
Maybe in the builder we can have something like
Undertow.builder()
.setNotFoundHandler( notFoundHandlerImpl )
.setServerErrorHandler( serverErrorHandlerImpl )
...