Skip to content
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

Merged
merged 2 commits into from
Nov 12, 2014
Merged

Closes #778. Checking result.used() before forward #867

merged 2 commits into from
Nov 12, 2014

Conversation

Turini
Copy link
Member

@Turini Turini commented Nov 3, 2014

I'm not sure if its the best implementation, but it fixes #778 without broke forward.

@Turini Turini added the bug label Nov 3, 2014
@Turini Turini self-assigned this Nov 3, 2014
@Turini
Copy link
Member Author

Turini commented Nov 4, 2014

what do you think @lucascs @garcia-jj?

@garcia-jj
Copy link
Member

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()) {
Copy link
Member

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(...)

💣

Copy link
Member Author

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?)

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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, 🚢

Copy link
Member Author

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.

Turini added a commit that referenced this pull request Nov 12, 2014
Closes #778. Checking result.used() before forward
@Turini Turini merged commit fc19dd2 into master Nov 12, 2014
@Turini Turini deleted the issue778 branch November 12, 2014 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Forward + Result.use is still trying to access my jsp
3 participants