diff options
Diffstat (limited to 'netx/net/sourceforge/jnlp')
-rw-r--r-- | netx/net/sourceforge/jnlp/JNLPFile.java | 28 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/PluginBridge.java | 23 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java | 20 |
3 files changed, 52 insertions, 19 deletions
diff --git a/netx/net/sourceforge/jnlp/JNLPFile.java b/netx/net/sourceforge/jnlp/JNLPFile.java index 1bee246..2596c47 100644 --- a/netx/net/sourceforge/jnlp/JNLPFile.java +++ b/netx/net/sourceforge/jnlp/JNLPFile.java @@ -645,4 +645,32 @@ public class JNLPFile { return newVMArgs; } + /** + * XXX: this method does a "==" comparison between the input JARDesc and + * jars it finds through getResourcesDescs(). If ever the implementation + * of that function should change to return copies of JARDescs objects, + * then the "jar == aJar" comparison below should change accordingly. + * @param jar: the jar whose download options to get. + * @return the download options. + */ + public DownloadOptions getDownloadOptionsForJar(JARDesc jar) { + boolean usePack = false; + boolean useVersion = false; + ResourcesDesc[] descs = getResourcesDescs(); + for (ResourcesDesc desc: descs) { + JARDesc[] jars = desc.getJARs(); + for (JARDesc aJar: jars) { + if (jar == aJar/*jar.getLocation().equals(aJar.getLocation())*/) { + if (Boolean.valueOf(desc.getPropertiesMap().get("jnlp.packEnabled"))) { + usePack = true; + } + if (Boolean.valueOf(desc.getPropertiesMap().get("jnlp.versionEnabled"))) { + useVersion = true; + } + } + } + } + return new DownloadOptions(usePack, useVersion); + } + } diff --git a/netx/net/sourceforge/jnlp/PluginBridge.java b/netx/net/sourceforge/jnlp/PluginBridge.java index a3ef9f3..b8f493a 100644 --- a/netx/net/sourceforge/jnlp/PluginBridge.java +++ b/netx/net/sourceforge/jnlp/PluginBridge.java @@ -40,6 +40,8 @@ public class PluginBridge extends JNLPFile { String[] cacheJars = new String[0]; String[] cacheExJars = new String[0]; Hashtable<String, String> atts; + private boolean usePack; + private boolean useVersion; public PluginBridge(URL codebase, URL documentBase, String jar, String main, int width, int height, Hashtable<String, String> atts) @@ -134,6 +136,27 @@ public class PluginBridge extends JNLPFile { // same page can communicate (there are applets known to require // such communication for proper functionality) this.uniqueKey = documentBase.toString(); + + usePack = false; + useVersion = false; + String jargs = atts.get("java_arguments"); + if (jargs != null) { + for (String s : jargs.split(" ")) { + String[] parts = s.trim().split("="); + if (parts.length == 2 && Boolean.valueOf(parts[1])) { + if ("-Djnlp.packEnabled".equals(parts[0])) { + usePack = true; + } else if ("-Djnlp.versionEnabled".equals(parts[0])) { + useVersion = true; + } + } + } + } + } + + @Override + public DownloadOptions getDownloadOptionsForJar(JARDesc jar) { + return new DownloadOptions(usePack, useVersion); } public String getTitle() { diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java index aae8b8b..6bebfc6 100644 --- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java +++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java @@ -1321,25 +1321,7 @@ public class JNLPClassLoader extends URLClassLoader { } private DownloadOptions getDownloadOptionsForJar(JARDesc jar) { - boolean usePack = false; - boolean useVersion = false; - - ResourcesDesc[] descs = file.getResourcesDescs(); - for (ResourcesDesc desc: descs) { - JARDesc[] jars = desc.getJARs(); - for (JARDesc aJar: jars) { - if (jar == aJar) { - if (Boolean.valueOf(desc.getPropertiesMap().get("jnlp.packEnabled"))) { - usePack = true; - } - if (Boolean.valueOf(desc.getPropertiesMap().get("jnlp.versionEnabled"))) { - useVersion = true; - } - } - } - } - - return new DownloadOptions(usePack, useVersion); + return file.getDownloadOptionsForJar(jar); } /* |