[undertow-dev] PathHandler and HANDLE_404,HANDLE_500

Efraim Gentil efraim.gentil at gmail.com
Tue Nov 18 14:35:41 EST 2014


Thanks Stuart, in the both ways worked pretty fine, the
FileErrorPageHandler is not exactly what i need but it gives the hints that
i needed. Thanks

2014-11-18 1:47 GMT-02:00 Stuart Douglas <sdouglas at redhat.com>:

> 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 at gmail.com>
> > To: undertow-dev at 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 at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/undertow-dev
>



-- 
Atenciosamente,
Efraim Gentil - @efraimgentil <https://twitter.com/efraimgentil>
Github <https://github.com/efraimgentil>
LinkedIn
<http://www.linkedin.com/profile/view?id=215608595&trk=nav_responsive_tab_profile_pic>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20141118/50d40560/attachment.html 


More information about the undertow-dev mailing list