views:

106

answers:

1

Essentially I am looking to have a url query parameter persist throughout the life of the grails application (POST or GET). ex.

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

I have tried a couple routes. Dynamic method overriding redirect and customizing application tags for createLink. However, since I also use grails webflows it doesn't quite get every single URL. I also tried using a groovy servlet (groovlet) to capture every URL and append the query parameter. The last attempt hasn't been very successful. Am I missing an obvious component to grails? Am I on the right track? Is there another avenue I haven't explored yet?

Thanks in advance

+1  A: 

Have you tried using a filter? The following filter will add the param to every request

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

} } }
Don
This is what I ended up doing with an additional check to redirect. The redirect made sure the url always contained the query parameter it.
avelis