Serving static files from grails plugin

189 Views Asked by At

I wrote a private plugin(MyPlugin) that is being used by other applications. It has a controller named MyPluginController and a bunch of REST actions. They all work fine when access through the mainapp. The plugin also comes with a single page app contained in static.html. I could not figure out how to do the UrlMapping for static.html to be accessible like: http://example.com/mainapp/MyPluginController/static.html

class MyPluginUrlMappings {

static mappings = {
    "/$controller/$action?/$id?(.$format)?"{
        constraints {
            // apply constraints here
        }
    }
"/"(view:"/index")
    "500"(view:'/error')

 /* Not sure what do here ???*/
 "/MyPluginController/static.html" (redirect: "/static.html", permanent: true)
}

The html is in myplugin's web-app folder. It is easy to rename it to .gsp and make it work but this is grails and I am sure there must be cleaner way of doing it.

0

There are 0 best solutions below