-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Include Future Directives Examples for Java. #20619
Conversation
Can one of the repo owners verify this patch? |
OK TO TEST |
.matchAny(ex -> | ||
complete(StatusCodes.InternalServerError(), | ||
String.format("An error occurred: %s", | ||
ex.getMessage()) |
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.
that's pretty much the reason we I'm a fan of 2 spaces formatting (and we'll soon enforce that) :-)
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.
I agree with you. I've updated it to 2 spaces formatting and now is much more readable :)
Will review more in the morning, thanks for the PRs! |
Test PASSed. |
@@ -0,0 +1,107 @@ | |||
/* | |||
* Copyright (C) 2009-2016 Lightbend Inc. <http://www.lightbend.com> |
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.
AFAIR, the time here should be '2016-2016' which stands for file-created-year to file-modified-year :)
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.
@Hawstein That should be nice too,just not that consistent,anyway ,we have git to track.
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.
Yep, just a little suggestion, not a big deal.
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.
Thanks for spotting it @Hawstein. I've updated it!
Test PASSed. |
// import static scala.compat.java8.JFunction.func; | ||
|
||
final Route route = path( | ||
PathMatchers.segment("divide") |
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.
Could we static import PathMatchers.*
and make the path matching a single nice line?
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.
And add a comment about importing that just like the func
comment.
LGTM with a few nitpicks |
Thanks @johanandren. I've amended the commit with your suggestions. |
Test PASSed. |
Thanks, excellent PR again @felipefzdz! To address your questions:
Perhaps an interesting thing would be to add overloads in Java that handle the success/failure as 2 callbacks hm... Yes, using the PFBuilder is OK here 👍
Right, but looks pretty decent now, thanks! |
This PR addresses the following directives for #20466
onComplete
directive passes an ScalaTry
to the inner route. The lack of pattern matching in Java makes pretty complex the handling of thatTry
. I had to usefunc
fromscala-java8-compat
, that's why I've included the package import commented out. In order to create a Partial Function I've usedPFBuilder
fromakka.japi.pf
package. That class is marked as EXPERIMENTAL, so I'm not sure if this is the intended way of consuming the result ofonSuccess
in Java.That example gets really deep nested. As it needs to fit in the box generated by Sphinx I had to break the lines with not the best readability.
As my previous PR, the code here has been indented with tabs. It will be reformatted whenever the Java formatter will be ready.