簡體   English   中英

GAE Java SDK:appengine-web.xml“ <static-file>

[英]GAE Java SDK: appengine-web.xml “<static-file><include…” priority

我正在使用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天設置“ cache-control”和“ expires” http標頭。

但是,當使用Firefox的Live 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>元素以達到預期的效果?

干杯,

傑夫

我已經回答了我自己的問題:之所以得到“ cache-control:max-age”值為0,而HTTP標頭中沒有“ expires”值,是因為我只是在Firefox中重新加載頁面。 在啟動新的私有瀏覽會話(重置進程中的緩存)並第一次加載頁面后,我收到了預期的標題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM