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

查看:631
本文介绍了如何将某些文件放在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.

在我的情况下,我需要有crossdomain.xml可用后运行grails run-app。我知道我可以将整个应用程序移动到根( 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.

他的技术是在此博客中首次提出的 entry ,其中作者还讨论了使用静态资源插件作为另一种替代方法

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天全站免登陆