How do I append custom query strings to grails Resources using a mapper?

前端 未结 1 1617
说谎
说谎 2021-01-16 12:54

I would like to create a Grails resources mapper that appends a query string to the actualUrl. All attempts thus far have failed - but maybe I\'m going about things the wron

相关标签:
1条回答
  • 2021-01-16 13:17

    You can append the params to the URL in *Resources.groovy i.e. at the point where the resource is declared (rather than in the mapper) using:

    resource url: '/js/foo.js', wrapper: { baseUrl ->          
      def query = [l:'en_US']
      baseUrl + '?' + query.collect { it }.join('&')
    }
    
    0 讨论(0)
提交回复
热议问题