Chuck
Chuck

Reputation: 1870

Do static and resource file sets in Google App Engine config interact?

The Google App Engine appengine-web.xml configuration file allows you to specify which files are static content and which files are resources. When you upload your app to Google only the content designated static will be placed on static content servers and only the files designated as resources will get pushed to the app servers (paraphrasing from https://developers.google.com/appengine/docs/java/config/appconfig).

I have some config statements that look like...

  <static-files>
    <include path="/**.html" />
    <include path="/**.js" />
    <include path="/**.css" />
    <include path="/**.ico" />
    <include path="/**.png" />
    <include path="/**.jpg" />
    <include path="/**.gif" />
  </static-files>

  <resource-files>
    <include path="/**.ftl" />
  </resource-files>

My questions are...

When I add files to the static-files list, does that mean they will not be shipped as resource files as well?

When I add files to the resource-files list, does that mean they won't be shipped as static files as well?

Or do I need to provide a complete exclude path set in each section?

The docs are ambiguous here (at least I don't see anything explicit). Since this is just a space savings optimization (and some upload time, I guess) it probably isn't too important to me yet. But I don't seem to have any way to tell if content did or didn't make it to either the static or resource areas when pushing to Google.

Thanks!

Upvotes: 0

Views: 1184

Answers (1)

Peter Knego
Peter Knego

Reputation: 80340

A few points:

  1. The point of static files is that they are served directly to the end user. They are not served by GAE server, but rather by a specialised (internal) Google CDN servers. This improves loading times. For static file you can also declare 'Cache-control' headers, even further improving loading time (as clients caches and downstream caches would cache it).

  2. Resource files are meant to be used by app code, not served directly. Afaik, they are still served as files, but they are served by GAE servers, because they need to be on GAE instances.

  3. Files in the public part of WAR are by default treated as both, static files and resource files. So you need to explicitly exclude them if you want them served as files.

  4. Files under /WEB-INF are never served, but can be accessed by code. Also files put into code directories (/src) can be accessed by code, but won't be served as static files (they will be copied into /WEB-INF/classes).

Upvotes: 4

Related Questions