Have a look at io.undertow.server.handlers.error.FileErrorPageHandler.
Basically you can use io.undertow.server.HttpServerExchange#addDefaultResponseListener to
generate default responses.
Stuart
----- Original Message -----
From: "Efraim Gentil" <efraim.gentil(a)gmail.com>
To: undertow-dev(a)lists.jboss.org
Sent: Tuesday, 18 November, 2014 1:59:05 PM
Subject: [undertow-dev] PathHandler and HANDLE_404,HANDLE_500
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 )
...
Thanks
--
Atenciosamente,
Efraim Gentil - @efraimgentil
Github
LinkedIn
_______________________________________________
undertow-dev mailing list
undertow-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/undertow-dev