我在哪里把GWT应用程序的静态文件?战争文件夹或公共文件夹? [英] Where do I put static files for GWT app? war folder or public folder?

查看:132
本文介绍了我在哪里把GWT应用程序的静态文件?战争文件夹或公共文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些JavaScript文件,一个主要的HTML文件,一个主要的CSS文件和一些CSS文件,它们被导入到主文件中。

I have some JavaScript files, a main HTML file, a main CSS file, and some CSS files that get imported into the main one.

我知道我可以把静态文件放在两个地方:a)'war'文件夹;或者b)公共文件夹。

I understand that I can put static files in two places: a) the 'war' folder; or b) the 'public' folder.

最适合放置静态文件的地方在哪里?这两个地点的处理方式不同吗?是否有关于此问题的最佳做法?

Where is the best place to put my static files? Are the two locations treated differently? Is there a 'best practice' on this issue?

推荐答案

这两个位置之间的区别在于公用文件夹中的文件是由gwt编译器复制到'war'文件夹中'your module'文件夹中。这意味着如果你部署'战争'(例如通过谷歌插件谷歌appengine)'公共'文件夹中的文件不在顶层。

The difference between the 2 locations is that files in the public folders are copied by the gwt compiler to the 'your module' folder in the 'war' folder. This is means if you deploy the 'war' (for example via the google plugin to the google appengine) the files from the 'public' folder are not at the toplevel.

例如,如果您在'public'文件夹中有一个名为'mymodule'的gwt模块的index.html,并将其部署到www.example.com,它看起来如下所示,您需要通过以下方式访问它:

For example, if you have an index.html in the 'public' folder with gwt module named 'mymodule' and you deploy it to www.example.com it looks as follows, you need to access it via:

www.example.com/mymodule/index.html

如果您在'war'文件夹中有index.html,您会得到:

If you have the index.html in the 'war' folder, you get:

www.example.com/index.html

总结。您的着陆页应该位于战争文件夹中。目标网页使用的资源文件也可以存储在此处(CSS,图像)。任何gwt模块文件(或代码,如图像)中引用的任何其他资源文件都应存储在与gwt模块相关的'public'文件夹中。

Summarizing. Your landing page should be in the 'war' folder. Resource files used by the landing page can also be stored here (css, images). Any other resource file that is referred to in any gwt module file (or code, like images) should be stored in the 'public' folder related to the gwt module.

这篇关于我在哪里把GWT应用程序的静态文件?战争文件夹或公共文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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