GAE Java SDK:appengine-web.xml "<static-file><include..."优先级



我正在使用Google App Engine Java SDK 1.7.2来提供一些静态文件。在appengine-web.xml的<static-files>下组合多个<include...元素时,我不确定哪些规则优先。

例如,我有以下内容:

<static-files>
  <include path="/**.swf" expiration="365d"></include>
  <include path="/**.jpg" expiration="365d"></include>
  <include path="/**"></include>    
  <exclude path="/**.php"></exclude>
</static-files>

我相信这指定了除.php文件之外的所有内容都应包含在静态存储中,并且.swf和.jpg文件应在未来 365 天内设置"缓存控制"和"过期"http 标头。

但是,当使用适用于 Firefox 的实时 HTTP 标头工具时,我看不到过期时间较长的静态文件的预期标头:

http://localhost:8888/swf/Logo.20120927.swf
GET /swf/Logo.20120927.swf HTTP/1.1
Host: localhost:8888
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20100101 Firefox/15.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
DNT: 1
Connection: keep-alive
Referer: http://localhost:8888/
If-Modified-Since: Thu, 27 Sep 2012 15:49:03 GMT
Cache-Control: max-age=0
HTTP/1.1 304 Not Modified
Server: Jetty(6.1.x)
----------------------------------------------------------
http://localhost:8888/images/logo-and-buttons.20120927.jpg
GET /images/logo-and-buttons.20120927.jpg HTTP/1.1
Host: localhost:8888
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20100101 Firefox/15.0.1
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-gb,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
DNT: 1
Connection: keep-alive
Referer: http://localhost:8888/
If-Modified-Since: Thu, 27 Sep 2012 15:49:03 GMT
Cache-Control: max-age=0
HTTP/1.1 304 Not Modified
Server: Jetty(6.1.x)
我的

问题是,如果这没有按预期运行,那么我如何配置我的<static-files>元素以达到预期的效果?

干杯

杰夫。

我已经

回答了我自己的问题:我得到的"缓存控制:最大年龄"值为 0,而我的 HTTP 标头中没有"过期"值,是因为我只是在 Firefox 中重新加载页面。在启动新的隐私浏览会话(在此过程中重置缓存)并首次加载页面时,我收到了预期的标头。

最新更新