有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

谷歌应用引擎GAE Java SDK:appengineweb。xml“<staticfile><include…”优先事项

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

例如,我有以下几点:

<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的Live HTTP Headers工具时,我看不到过期时间较长的静态文件的预期头:

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>元素以达到预期效果

干杯

杰夫


共 (1) 个答案

  1. # 1 楼答案

    我已经回答了我自己的问题:我之所以得到0的“cache control:max age”值,并且在我的HTTP头中没有“expires”值,是因为我刚刚在Firefox中重新加载页面。在启动新的私人浏览会话(重置过程中的缓存)并首次加载页面时,我收到了预期的标题