我目前正在研究 embeds 的 Web 应用程序<applet>
,它有几个依赖项(.jar 文件)。
Applet 标签看起来像这样:
<applet ...
type="application/x-java-applet"
codebase="/webapp/applet">
...
<param name="codebase" value="./applet"/>
<param name="archive" value="a.jar,b.jar,c.jar"/>
<param name="codebase_lookup" value="false"/>
</applet>
Applet 工作正常,但问题是,当它第一次加载时,那些 a.jar、b.jar、c.jar 等正在从 Web 服务器请求(和下载)很多(20-300)次,每个,这使得小程序启动很慢。
发生了什么事,是否为每个加载的类分别重新下载 jars?
有没有办法正确优化/配置小程序?尝试了几种缓存技巧(例如<param name="cache_archive" />
,但没有成功,甚至不确定这是解决此问题的正确方法。
注意!这个小程序是WS 客户端(有一些JAXB注释的类和相关的依赖项)。
小程序登录启动有很多:
network: Connecting http://127.0.0.1:7001/webapp/applet/a.jar with proxy=DIRECT
network: Connecting http://127.0.0.1:7001/webapp/applet/a.jar with proxy=DIRECT
network: Connecting http://127.0.0.1:7001/webapp/applet/a.jar with proxy=DIRECT
... ~100 more times a.jar is downloaded
network: Connecting http://127.0.0.1:7001/webapp/applet/a.jar with proxy=DIRECT
network: Connecting http://127.0.0.1:7001/webapp/applet/b.jar with proxy=DIRECT
network: Connecting http://127.0.0.1:7001/webapp/applet/b.jar with proxy=DIRECT
network: Connecting http://127.0.0.1:7001/webapp/applet/c.jar with proxy=DIRECT
network: Connecting http://127.0.0.1:7001/webapp/applet/a.jar with proxy=DIRECT
network: Connecting http://127.0.0.1:7001/webapp/applet/c.jar with proxy=DIRECT
...
Web服务器访问日志反映小程序日志:
127.0.0.1 - "GET /webapp/applet/a.jar HTTP/1.1" 200 1232582
127.0.0.1 - "GET /webapp/applet/a.jar HTTP/1.1" 200 1232582
127.0.0.1 - "GET /webapp/applet/a.jar HTTP/1.1" 200 1232582
...
127.0.0.1 - "GET /webapp/applet/a.jar HTTP/1.1" 200 1232582