我在确定为什么客户端没有缓存一些沉重的 .jar 文件时遇到问题。
小程序运行良好,但它在每次运行时都会延迟下载沉重的 jar 库(特别是 aws-java-sdk 和 xuggler)
小程序:
用 javascript 应用于 HTML DOM
<applet archive="MyScreencast.jar" code="SrcApplet.class" codebase="http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/" height="50" width="130">
<param name="cache_archive" value="lib/swing-layout-1.0.4.jar, lib/slf4j-api-1.6.4.jar, lib/slf4j-jcl-1.6.4.jar, lib/xuggle-xuggler-noarch-5.4.jar, lib/aws-java-sdk-1.4.0.jar, lib/commons-codec-1.3.jar, lib/commons-logging-1.1.1.jar, lib/httpclient-4.1.1.jar, lib/httpcore-4.1.jar, lib/xuggle-xuggler-arch-x86_64-w64-mingw32.jar, lib/xuggle-xuggler-arch-x86_64-xuggle-darwin11.jar, lib/xuggle-xuggler-arch-x86_64-pc-linux-gnu.jar">
<param name="cache_version" value="1.0, 1.4.0, 1.3, 1.1.1, 4.1.1, 4.1, 1.6.4, 5.4.0">
<param name="jnlp_href" value="http://beta.remoting.io/screencasts/118/launch.jnlp">
<param name="outputFileName" value="filename.mp4">
<param name="token" value="secrettoken">
<param name="image" value="http://djebp0fi6w5vu.cloudfront.net/assets/ajax-loader-40b35ac3503bcb1279f0851d57d2b62a.gif">
<param name="name" value="myscreencast">
</applet>
启动.jnlp
标题:
HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Content-Type: application/x-java-jnlp-file; charset=utf-8
Date: Thu, 18 Apr 2013 06:51:43 GMT
Etag: "0acc9670f5347a89063c1ad76ba6a931"
Status: 200 OK
X-Rack-Cache: miss
X-Request-Id: b26b35dc9b336fd42da4f2bf0403b58c
X-Runtime: 0.261893
X-Ua-Compatible: IE=Edge,chrome=1
Connection: keep-alive
回复:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp href="/screencasts/118/launch.jnlp" spec="1.0+">
<information>
<title>MyScreencast</title>
<vendor>dotg</vendor>
<homepage href="/screencasts/118/launch.html"/>
<description>MyScreencast</description>
<description kind="short">MyScreencast</description>
</information>
<update check="always"/>
<security>
<all-permissions/>
</security>
<resources>
<j2se java-vm-args="-Djava.security.policy=http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/applet.policy" version="1.6+"/>
<jar href="http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/MyScreencast.jar" main="true"/>
<resources arch="x86_64" os="Windows">
<nativelib href="http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/lib/xuggle-xuggler-arch-x86_64-w64-mingw32.jar"/>
</resources>
<resources arch="x86_64" os="Mac OS X">
<nativelib href="http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/lib/xuggle-xuggler-arch-x86_64-xuggle-darwin11.jar"/>
</resources>
<resources arch="x86_64" os="Linux">
<nativelib href="http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/lib/xuggle-xuggler-arch-x86_64-pc-linux-gnu.jar"/>
</resources>
<jar download="lazy" href="http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/lib/swing-layout-1.0.4.jar"/>
<jar download="lazy" href="http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/lib/slf4j-api-1.6.4.jar"/>
<jar download="lazy" href="http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/lib/slf4j-jcl-1.6.4.jar"/>
<jar download="lazy" href="http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/lib/xuggle-xuggler-noarch-5.4.jar"/>
<jar download="lazy" href="http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/lib/aws-java-sdk-1.4.0.jar"/>
<jar download="lazy" href="http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/lib/commons-codec-1.3.jar"/>
<jar download="lazy" href="http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/lib/commons-logging-1.1.1.jar"/>
<jar download="lazy" href="http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/lib/httpclient-4.1.1.jar"/>
<jar download="lazy" href="http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/lib/httpcore-4.1.jar"/>
</resources>
<applet-desc height="32" main-class="com.dotg.screencast.ScrApplet" name="MyScreencast" width="32">
<param name="token" value="secrettoken"/>
<param name="outputFileName" value="somefilename.mp4"/>
</applet-desc>
</jnlp>
.jar 文件
标题:
$ curl -I http://s3.amazonaws.com/remoting-io-cdn/recorder/v3/lib/aws-java-sdk-1.4.0.jar
HTTP/1.1 200 OK
x-amz-id-2: +VVx4kAqF4o+aQ+TdzLLCY8aMxcaYtP739ZcttwyFXrYK3lJgG9xnZ0nErtT8+cu
x-amz-request-id: D16687EF72E5F892
Date: Thu, 18 Apr 2013 18:17:12 GMT
Cache-Control: public, max-age=31557600
Last-Modified: Thu, 18 Apr 2013 13:18:48 GMT
ETag: "f577609185df722d54e85b822dbd043c"
Accept-Ranges: bytes
Content-Type: application/x-java-archive
Content-Length: 10293926
Server: AmazonS3
为什么 .jar 文件没有被缓存?