Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do I put static files for GWT app? war folder or public folder?

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

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?

like image 353
David Avatar asked Oct 01 '09 06:10

David


2 Answers

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.

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

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

www.example.com/index.html

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.

like image 159
Hilbrand Bouwkamp Avatar answered Oct 21 '22 01:10

Hilbrand Bouwkamp


The new way of working in GWT is to use the war folder.

But, if you project is a reusable widget library which is used in a GWT application then you should put the resources in the public folder. The compiler will make sure that the files are automatically included in the generated package.

like image 23
David Nouls Avatar answered Oct 21 '22 03:10

David Nouls