1
votes

Want to make the URLs SEO friendly when using grails webflow. It is quite limiting with the convention grails uses and hard to go around the way it's built. For example, i have a flow called fooProcess in the controller called FooController, when i trigger the flow i would like the display: /foo/bar/test, instead of /foo/fooProcess?excecution=e1s2

class FooController {
 def fooProcessFlow {
   showFoo {
   }
 }
}

I tried using redirect and specify the uri but that's not supported, grails complains that the page isn't found

fooProcessFlow {
 showFoo {                              
   redirect(uri:"/foo/bar/test")    
 }
}

grails/foo/fooProcess.dispatch/externalRedirect:/foo/bar/test

Also, a redirect is an end state in a flow, if I only want to render the page, i have to use the render method and specify the view name or structure my views according to webflow convention.

fooProcessFlow {
 showFoo {                              
   render(view:"/foo/bar/test") 
   on "add".to "add"
 }
}

The url will be in this case

/foo/fooProcessProcess?execution=e6s1

Anyone dealt with this case before ?

Did anyone use UrlRweriteFilter with webflows in grails http://code.google.com/p/urlrewritefilter/

ken

1

1 Answers

-1
votes

You can use URLMappings Grails Plugin

See: http://grails.org/doc/latest/ref/Plug-ins/URL%20mappings.html

Edit this file: grails-app/conf/UrlMappings.groovy

Putting something like this inside:

class UrlMappings {

    static mappings = {

        "/foo/bar/test" (controller: "foo", action: "fooProcessFlow")

        "/$controller/$action?/$ids?"{
            constraints {
            }
        }
    }
}