如何将某些文件放在 Grails 服务器的根目录中? [英] How to place certain files in the root directory of the Grails server?

查看:30
本文介绍了如何将某些文件放在 Grails 服务器的根目录中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 grails 应用程序作为 Flex 前端的后端.为了能够轻松地开发和调试我的应用程序,我需要将一个 crossdomain.xml 文件放入服务器的根目录中,即它必须可以通过 http://localhost:8080/crossdomain.xml.类似的用例可能是 favicon.ico 或 robots.txt 的部署,但是这可以在生产环境中通过带有默认根 Web 应用程序的 tomcat 服务器来完成.

I am using a grails application as backend for a Flex frontend. To be able to easily develop and debug my applications I would need to place a crossdomain.xml file into the root of the server, i.e. it must be accessible via http://localhost:8080/crossdomain.xml. Similar use cases might be the deployment of a favicon.ico or a robots.txt, however this can be done in the production environment through a tomcat server with a default root web application.

但是,在我的情况下,我需要在运行 grails run-app 后使 crossdomain.xml 可用.我知道我可以将整个应用程序移动到根目录 (http://ca.rroll.net/2009/03/27/configuring-the-grails-root-application-context/) 但这也不是我想要的,因为 grails 应用程序仍应位于其默认应用程序上下文之下.

In my case however I need to have the crossdomain.xml available after running grails run-app. I know that I can move the entire application to the root (http://ca.rroll.net/2009/03/27/configuring-the-grails-root-application-context/) however this is also not what I want, since the grails application should still reside below its default application context.

有人知道我怎么做吗?我是否必须以某种方式重新配置我的 grails 安装的 jetty servlet 容器?

Does somebody know, how I can do this? Will I have to reconfigure the jetty servlet container of my grails installation somehow?

推荐答案

我想我找到了答案.我还没试过,所以YMMV.

I think I found the answer. I haven't tried this yet, so YMMV.

在这篇文章中,Colin Harrington 讨论了制作通过部署额外的 Jetty 上下文,在服务器的根目录下提供一个 crossdomain.xml 文件.

In this article, Colin Harrington discusses making a crossdomain.xml file available at the root of the server by deploying an additional Jetty context.

他的技术最初是在这个博客条目中提出的,作者还讨论了使用静态资源插件作为另一种选择

His technique was first proposed in this blog entry, where the author also discusses using the Static Resources Plugin as another alternative

这篇关于如何将某些文件放在 Grails 服务器的根目录中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆