Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get request URL from grails controller

My grails controller gets invoked by the following URLs

/center/madrid/12-de-octubre
/center/madrid/12-de-octubre?opt=1

I need the controller to behave differently if there are any parameters after the ? in the URL

I have the following URL mapping:

   name center: "/center/$_uni_city/$_uni_facility_name" {
        controller = "site"
        action = "centerprofile"
} 

While I can find all parameters (e.g. _uni_city=Madrid, opt=1) I am unable to determine which parameters come from the querystring after applying URLMappings (i.e. opt in the example above).

Is there a way to retrieve the original request URL (i.e.
/center/madrid/12-de-octubre?opt=1) in the grails controller?

like image 433
user3028981 Avatar asked Feb 14 '23 13:02

user3028981


1 Answers

To get the original parameters in the request URL use:

request.queryString 
like image 166
user3028981 Avatar answered Feb 27 '23 23:02

user3028981