-
Notifications
You must be signed in to change notification settings - Fork 329
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
Closes #778. Checking result.used() before forward #867
Conversation
what do you think @lucascs @garcia-jj? |
I'm unable to test in my application right now. But the code sounds like good. |
@@ -111,7 +115,8 @@ public Object intercept(T proxy, Method method, Object[] args, SuperMethod super | |||
if (!(returnType == void.class)) { | |||
request.setAttribute(extractor.nameFor(returnType), methodResult); | |||
} | |||
if (response.isCommitted()) { | |||
|
|||
if (response.isCommitted() || result.used()) { |
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.
result is always used here.
because you do:
result.forwardTo(...)...
//which calls
result.use(logic()).forwardTo(...)
💣
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.
@lucascs it won't, take a closer look at the other change.
Result#forwardTo isn't setting used as true anymore.
I couldn't find a place that requires it (am I missing something?)
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.
yes you are...
if you forward and the request ends it will try to forward to default view.
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 you forward to a method that only does result.nothing(), for example, it will forward to the original method's jsp, or something like it.
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.
No @lucascs, it doesn't break the cases you've mentioned... are you looking
for the entire PR? Please, take a look at DefaultResult#forwardTo
method.
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.
Ok... but it will break if the person used result.use(logic()).forwardTo(...)
But ok, 🚢
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.
@lucascs, you're wrong... result.use(logic()).forwardTo(...)
still working too.
I didn't change the use
behavior. Only default forwardTo
that doesn't set as used.
Closes #778. Checking result.used() before forward
I'm not sure if its the best implementation, but it fixes #778 without broke forward.