0

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!

Chuck
  • 1,850
  • 2
  • 17
  • 28

1 Answers1

4

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).

Community
  • 1
  • 1
Peter Knego
  • 79,991
  • 11
  • 123
  • 154
  • Thanks for answering. I was aware of these points for the most part, except for your note about exclusion in point 3. That was the main point of my question. So you're saying that if I want something as a static file but not a resource, I need to explicitly exclude them (and vice versa) in the resource list. And vice versa. – Chuck Mar 08 '13 at 15:48
  • Yes, this is what the docs say. 3rd & 4th paragraph: https://developers.google.com/appengine/docs/java/config/appconfig#Static_Files_and_Resource_Files – Peter Knego Mar 08 '13 at 16:02
  • Actually, upon rereading the docs, it looks like by adding a single include directive, you restrict the set to just what is included. Adding an exclude directive only reduces the included set. So in my example I would not have to add the ftl pattern as an exclusion in the list of static files. Only the included patterns will be sent to the CDN servers. Thanks. – Chuck Mar 08 '13 at 16:28