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
Problem With Forward Params #9526
Comments
@jeffbrown Thanks for catching this. Thought this was MY ISSUE in my code and was trying over and over to troubleshoot and remove params after forward until I saw bug. Seeing issue with sending it other ways as well.
causes same error after multiple forwards. Tried to correct with params.remove but doesn't seem to work... Here are example of test params coming back after forwarding ONCE(note:batchIncrement->batchInc was incremented one time):
So it looks like it is concatenating the params somehow with every forward... |
Ok, after some investigation, I suspect this may be due to DefaultLinkGenerator.groovy ( https://github.com/grails/grails-core/blob/0b1d6a6d02f2217643a69e8314f76078dacbce32/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultLinkGenerator.groovy ) in that it doesn't take into consideration forwarding multiple times; it looks like this would concatenate them when URLEncoding them back in and if you forward multiple times, the params just keep getting concatenated. Does this sound correct? Am I reading this wrong |
This seems to be same issue as #9531 |
I don't think this is a bug, this is the way servlet containers work. If you forward the request the original request parameters are available to the receiving controller/action. So if you do:
You are essentially duplicating what the container already does for you, hence why you get 2 of everything (the original params and the new ones that have the same name as the originals). If you simply write:
This will give you the desired behaviour |
keen thanks. :) |
@graemerocher Actually I would argue this IS A BUG in the fact that above, you can see that it isn't forwarding the params changes. I just went ahead and tested again and confirmed. If you concatenate prior to a forward, that change won't show... at least it isn't showing when I make changes at the handlerInterceptor level. And since a forward can happen then as well and params changes can happen that late prior to forward, it makes sense that they should be able to get in and be seen in the forward. If you look at the data above, you will see the first set of params sent back that are concatenating don't have the changes made to the params. Am I doing something wrong? |
I think this is a case where the way to make it work would be to mutate the original Thanks for the feedback. |
Thanks. Posted question in 'questions' on slack. Much appreciated. |
I got the problem, during migration from grails 2 |
If I send a request to a url like http://localhost:8080/demo/someAction?firstName=Jeff, the response includes something like
First Name: [Jeff, Jeff]
.I see the behavior in 3.1.0.RC1 and 3.0.10.
Probably related to the issue at #9525 but I can't tell if that is what is being reported there or not.
The text was updated successfully, but these errors were encountered: