-
Notifications
You must be signed in to change notification settings - Fork 20
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
Updating ParameterLoader to work like an Interceptor, so the ControllerMethod isn't executed when a notFound() occurs. #31
base: master
Are you sure you want to change the base?
Conversation
…lerMethod when the entity's ID isn't found. This solves issue #13.
if (!containsLoadAnnotation(method)) return; | ||
|
||
|
||
@AroundCall |
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.
if it always call stack.next()
, you could use @BeforeCall
instead
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.
It doesn't always calls stack.next()
. When the loaded entity is null, in line 94, the interceptor is interrupted after setting result.notFound();
…e methods. According to @Turini, this improves performance.
@rafaelGuerreiro I couldn't test it yeat. Did you test it in a real project? but the code looks good to me 👍 |
…method when ExecuteMethod executes the controller's method.
@Turini, sorry, I didn't test in a real project. But I did a few minutes ago. And it didn't work =S I made a new commit changing from FlashScoped to MethodInfo. And now it works. Could you, please, explain the FlashScoped to me? |
The |
Well, when using FlashScope, the object wasn't setted on the ControllerMethod. It was passed as a new instance. When changing to MethodInfo, it started working properly. This happens when changing from an Observer to an Interceptor. It doesn't make much sense why FlashScope works with observer, since no redirect was made after the actual request, right? |
This commit is a nice to have as well. Can it be merged? |
sorry @rafaelGuerreiro, really busy week! I'll take a look on it asap |
@@ -95,7 +118,12 @@ public void load(@Observes ControllerFound event) { | |||
} | |||
} | |||
} | |||
flash.includeParameters(method, args); |
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.
why did you remove this line? it's an important/expected behavior
I left a few comments, @rafaelGuerreiro. thks |
Sorry about closing the PR #29, but I've had to correct my branches.
ParameterLoad should be an interceptor and shouldn't call the ControllerMethod when the entity's ID isn't found. This solves the issue #13.