Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Evict GrailsParameterMap objects before building flow execution url #311

Merged
merged 1 commit into from

2 participants

@robbugh

The webRequest params used to build the flow execution url can contain nested GrailsParameterMap objects if the "params" attribute (of a redirect call in a controller, for instance) contains structured keys, e.g., a redirect to the "customerFlow",

redirect(action:customer, params: ['customer.id': 123])

In this case, when the params attribute is parsed a synthetic GrailsParameterMap object will be created and added to the controller's params map with the key/value, customer: [id:123]. These synthetic GrailsParameterMap parameters should not be included in the resulting flow execution URL as they can interfere with the original parameters, 'customer.id' in this case, when the flow execution URL is parsed by the flow execution engine.

@graemerocher graemerocher merged commit 3d1a7c8 into grails:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
13 ...ain/groovy/org/codehaus/groovy/grails/webflow/context/servlet/GrailsFlowUrlHandler.groovy
@@ -29,6 +29,7 @@ import org.codehaus.groovy.grails.web.mapping.UrlCreator
import org.codehaus.groovy.grails.web.mapping.UrlMappingsHolder
import org.codehaus.groovy.grails.web.servlet.GrailsApplicationAttributes
import org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest
+import org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap
import org.codehaus.groovy.grails.webflow.execution.GrailsFlowExecutorImpl
/**
@@ -54,7 +55,17 @@ class GrailsFlowUrlHandler extends DefaultFlowUrlHandler implements ApplicationC
def newParams = [execution:flowExecutionKey]
for (entry in params) {
def key = entry.key
- if (key instanceof String) {
+ if (entry.value instanceof GrailsParameterMap) {
+ // GrailsParameterMap objects in the GrailsWebRequest parameters are synthetically created
+ // and added when the "params" attribute (of a redirect call in a controller, for instance)
+ // contains structured keys, e.g., "params: ['customer.id': 123]". In this case a new
+ // GrailsParameterMap object will be created and added to the controller's params map
+ // with the key/value, customer: [id:123]. These synthetic GrailsParameterMap parameters
+ // should not be included in the resulting flow execution URL as they can interfere
+ // with the original parameters, 'customer.id' in this case, when the flow execution URL
+ // is parsed by the flow execution engine.
+ continue
+ } else if (key instanceof String) {
if (key.startsWith("_event") || key == 'execution') continue
newParams[key] = entry.value
Something went wrong with that request. Please try again.