Search code examples
grailshttprequest

Is there a way to avoid amp; prepending to request parameter name in GrailsParameterMap


My request URL is

http://localhost:8080/application/controller/action?param1=value1&param2=value2

I obtain request params in controller through grails-core/WebAttributes.groovy

/**
* Obtains the Grails parameter map
*
* @return The GrailsParameterMap instance
*/
GrailsParameterMap getParams() {
    currentRequestAttributes().getParams()
}

The 2nd param in the map is of structure

{LinkedHashMap$Entry@00000} "amp;param2" -> "value2"

How or is it possible to eliminate "amp;"?


Solution

  • Your request URL (https://en.wikipedia.org/wiki/Query_string) includes parameters named amp;param2 and similar; parameters are separated by ampersands, not HTML-encoded ampersands. This is not a problem with Grails, but instead with however you are generating your URL.

    How are you generating the request URL that you reference here?