Persist url parameter in grails application

Essentially, I'm looking for the url request parameter to persist throughout the life of grails (POST or GET). e.g.

http://localhost:8080/demo/controller/action/?myParam=foobar

I tried a couple of routes. The dynamic method overrides the redirection and configures application tags for createLink . However, since I also use grails web streams, it doesn’t quite get every URL. I also tried using the groovy servlet ( groovlet ) to capture every URL and add a query parameter. The last attempt was not very successful. Am I missing the obvious component for the grail? Am I on the right track? Is there another prospectus that I have not yet studied?

Thanks in advance

+3
source share
1 answer

Have you tried to use filter ? The following filter will add a parameter to each request.

class MyFilters {
   def filters = {
       addParam(controller:'*', action:'*') {
           before = {
               params.myParam = 'foobar'
           }

} } }
+3
source

Source: https://habr.com/ru/post/1748215/


All Articles