从grails插件提供静态文件

时间:2014-08-11 16:04:58

标签: grails grails-2.0 grails-plugin grails-controller grails-2.4

我写了一个其他应用程序正在使用的私有插件( MyPlugin )。它有一个名为 MyPluginController 的控制器和一堆REST动作。通过mainapp访问时,它们都可以正常工作。该插件还附带 static.html 中包含的单页应用。我无法弄清楚如何将 static.html 的UrlMapping设为可访问,如: 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)
}

html位于myplugin的web-app文件夹中。很容易将它重命名为.gsp并使其工作,但这是grails,我相信必须有更清洁的方法。

0 个答案:

没有答案
相关问题