New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created a method to add a custom 404 error handler to router #801
Conversation
* @param handler the handler to run | ||
* @return a reference to this, so the API can be used fluently | ||
*/ | ||
Router setNotFoundHandler(Handler<RoutingContext> handler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing @Fluent
annotation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name it instead notFoundHandler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@slinkydeveloper ping on this :-)
@@ -374,4 +374,12 @@ static Router router(Vertx vertx) { | |||
*/ | |||
void handleFailure(RoutingContext context); | |||
|
|||
/** | |||
* Set an error handler for 404 Not Found error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please document when the handler should be called
please avoid reformed code that is not modified (extra blank are added) |
I've also updated doc inside package-info |
this looks ok to merge, @pmlopes WDYT ? |
Any chance this is going to be merged soon? We have a bug in production that depends on this PR :-( |
@slinkydeveloper can you rebase ? |
Signed-off-by: francesco <francescoguard@gmail.com>
Signed-off-by: francesco <francescoguard@gmail.com>
Signed-off-by: francesco <francescoguard@gmail.com>
a26c812
to
dd068f9
Compare
@vietj done, please check if I've done mistakes with new docs |
Is there a target milestone for this to be merged? |
Any updates on this? I've been searching for how to correctly register a default 404 handler for about an hour now (the only documentation is basically nonexistent https://vertx.io/docs/vertx-web/java/#_default_404_handling ) and |
@pmlopes any reason we can't merge this ? |
one reason is that there are un-resolve items in the PR |
Should I rebase? |
there does not eem to have conflicts, there are unanswered concerns I commented on a few monthgs ago |
like rename setNotFoundHandler to notFoundHandler, etc... |
Hi @ixtli. On my project we are registering an Handler to the router like this : final NotFoundHandler notFoundHandler = new NotFoundHandler ();
router.route().last().handler(notFoundHandler); Since our general handlers doesn't call "next" then the NotFoundHandler will only be called on route that are not going through the "general handler". If a route is found then the normal handler is called and the NotFoundHandler is not called (as we don't call "next" on this handler). It could be a workaround but you have to be careful on how you implement your "general handler". |
This PR #1140 should definitely solve the error handling. Can you give feedback/partecipate to the discussion? |
Solved by #1142 |
Added a method to Router interface to assign a custom 404 not found error handler
Signed-off-by: francesco francescoguard@gmail.com