gpt4 book ai didi

java - Applet 不缓存 jar 文件

转载 作者:行者123 更新时间:2023-11-29 09:03:43 25 4
gpt4 key购买 nike

我在确定为什么没有在客户端缓存一些繁重的 .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>

launch.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 文件?

最佳答案

javaws 有一些选项可以帮助您研究缓存。

特别是,运行 javaws -viewer

Java Web Start:
Usage: javaws [run-options] <jnlp-file>
javaws [control-options]

where run-options include:
-verbose display additional output
-offline run the application in offline mode
-system run the application from the system cache only
-Xnosplash run without showing a splash screen
-J<option> supply option to the vm
-wait start java process and wait for its exit

control-options include:
-viewer show the cache viewer in the java control panel
-clearcache remove all non-installed applications from the cache
-uninstall remove all applications from the cache
-uninstall <jnlp-file> remove the application from the cache
-import [import-options] <jnlp-file> import the application to the cache

import-options include:
-silent import silently (with no user interface)
-system import application into the system cache
-codebase <url> retrieve resources from the given codebase
-shortcut install shortcuts as if user allowed prompt
-association install associations as if user allowed prompt

关于java - Applet 不缓存 jar 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16090508/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com