aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp/PluginBridge.java
diff options
context:
space:
mode:
authorDanesh Dadachanji <[email protected]>2012-06-04 13:35:25 -0400
committerDanesh Dadachanji <[email protected]>2012-06-04 13:35:25 -0400
commitb6a2b55190c36fd9b42fdb3c61e8ff0e06776263 (patch)
tree194690c969f4375fa9e690ccb81446944e2fda3f /netx/net/sourceforge/jnlp/PluginBridge.java
parent9a31bacf619e4f9ffa32fb6c1e348079db2d417c (diff)
Handle absolute paths passed into jnlp_href's value.
Diffstat (limited to 'netx/net/sourceforge/jnlp/PluginBridge.java')
-rw-r--r--netx/net/sourceforge/jnlp/PluginBridge.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/netx/net/sourceforge/jnlp/PluginBridge.java b/netx/net/sourceforge/jnlp/PluginBridge.java
index 273b213..d241f7c 100644
--- a/netx/net/sourceforge/jnlp/PluginBridge.java
+++ b/netx/net/sourceforge/jnlp/PluginBridge.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2007 Red Hat, Inc.
+ * Copyright 2012 Red Hat, Inc.
* This file is part of IcedTea, http://icedtea.classpath.org
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -46,10 +46,20 @@ public class PluginBridge extends JNLPFile {
private boolean codeBaseLookup;
private boolean useJNLPHref;
+ /**
+ * Creates a new PluginBridge using a default JNLPCreator.
+ */
public PluginBridge(URL codebase, URL documentBase, String jar, String main,
int width, int height, Hashtable<String, String> atts,
String uKey)
throws Exception {
+ this(codebase, documentBase, jar, main, width, height, atts, uKey, new JNLPCreator());
+ }
+
+ public PluginBridge(URL codebase, URL documentBase, String jar, String main,
+ int width, int height, Hashtable<String, String> atts,
+ String uKey, JNLPCreator jnlpCreator)
+ throws Exception {
specVersion = new Version("1.0");
fileVersion = new Version("1.1");
this.codeBase = codebase;
@@ -59,8 +69,10 @@ public class PluginBridge extends JNLPFile {
if (atts.containsKey("jnlp_href")) {
useJNLPHref = true;
try {
- URL jnlp = new URL(codeBase.toExternalForm() + atts.get("jnlp_href"));
- JNLPFile jnlpFile = new JNLPFile(jnlp, null, false, JNLPRuntime.getDefaultUpdatePolicy(), this.codeBase);
+ // Use codeBase as the context for the URL. If jnlp_href's
+ // value is a complete URL, it will replace codeBase's context.
+ URL jnlp = new URL(codeBase, atts.get("jnlp_href"));
+ JNLPFile jnlpFile = jnlpCreator.create(jnlp, null, false, JNLPRuntime.getDefaultUpdatePolicy(), codeBase);
Map<String, String> jnlpParams = jnlpFile.getApplet().getParameters();
info = jnlpFile.info;
@@ -76,8 +88,8 @@ public class PluginBridge extends JNLPFile {
} catch (MalformedURLException e) {
// Don't fail because we cannot get the jnlp file. Parameters are optional not required.
// it is the site developer who should ensure that file exist.
- System.err.println("Unable to get JNLP file at: " + codeBase.toExternalForm()
- + atts.get("jnlp_href"));
+ System.err.println("Unable to get JNLP file at: " + atts.get("jnlp_href")
+ + " with context of URL as: " + codeBase.toExternalForm());
}
} else {
// Should we populate this list with applet attribute tags?