【问题标题】:Simplest way to serve static data from outside the application server in a Grails application在 Grails 应用程序中从应用程序服务器外部提供静态数据的最简单方法
【发布时间】:2014-09-28 08:44:00
【问题描述】:

This ticket 对这张票很像。但是,如果我们有一个 grails 项目结构,我们想知道在哪里放置这个标签:

<Context docBase="/path/to/images" path="/images" />

否则,如果我们想利用 grails 的特性,那么编写这样的操作就足够了吗

def ResourceConroller{
      static dir='/usr/share/lib/'
      def getImg(){
        def name=params?.name
        render(contentType:"image/png"){
          //What we should write here : might us convert image to bytes !? .. NO IDEA
        }
     }
}

【问题讨论】:

    标签: grails external static-content


    【解决方案1】:

    最简单的方法是使用grails install-templates 命令,然后修改src/templates/war/web.xml 以包含新的虚拟目录/上下文路径。

    【讨论】:

      猜你喜欢
      • 2010-12-21
      • 1970-01-01
      • 2013-05-05
      • 1970-01-01
      • 1970-01-01
      • 2011-09-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多