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

查看:28
本文介绍了我在哪里放置 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) 'public' 文件夹.

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"文件夹中.这意味着如果您部署war"(例如通过 google 插件到 google appengine),public"文件夹中的文件不在顶层.

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

总结.您的登陆页面应该在war"文件夹中.登陆页面使用的资源文件也可以存储在这里(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天全站免登陆