diff options
author | Andrew Su <[email protected]> | 2011-06-08 13:32:54 -0400 |
---|---|---|
committer | Andrew Su <[email protected]> | 2011-06-08 13:32:54 -0400 |
commit | 951ed82e0114529ca7160ca4da372adb89e99d69 (patch) | |
tree | 05bc8f09e5310d9d9823ecb3f318f412dd3563c6 /netx/net/sourceforge/jnlp/Parser.java | |
parent | 5d7c7a2009f1ccdc91cc5038cfd79d3f51a4ca4a (diff) |
Enable passing applet parameters through JNLP files.
Diffstat (limited to 'netx/net/sourceforge/jnlp/Parser.java')
-rw-r--r-- | netx/net/sourceforge/jnlp/Parser.java | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/netx/net/sourceforge/jnlp/Parser.java b/netx/net/sourceforge/jnlp/Parser.java index aeb03b9..917cad2 100644 --- a/netx/net/sourceforge/jnlp/Parser.java +++ b/netx/net/sourceforge/jnlp/Parser.java @@ -110,6 +110,27 @@ class Parser { * @throws ParseException if the JNLP file is invalid */ public Parser(JNLPFile file, URL base, Node root, boolean strict, boolean allowExtensions) throws ParseException { + this(file, base, root, strict, allowExtensions, null); + } + + /** + * Create a parser for the JNLP file. If the location + * parameters is not null it is used as the default codebase + * (does not override value of jnlp element's href + * attribute).<p> + * + * The root node may be normalized as a side effect of this + * constructor. + * + * @param file the (uninitialized) file reference + * @param base if codebase is not specified, a default base for relative URLs + * @param root the root node + * @param strict whether to enforce strict compliance with the JNLP spec + * @param allowExtensions whether to allow extensions to the JNLP spec + * @param codebase codebase to use if we did not parse one from JNLP file. + * @throws ParseException if the JNLP file is invalid + */ + public Parser(JNLPFile file, URL base, Node root, boolean strict, boolean allowExtensions, URL codebase) throws ParseException { this.file = file; this.root = root; this.strict = strict; @@ -122,7 +143,9 @@ class Parser { // JNLP tag information this.spec = getVersion(root, "spec", "1.0+"); this.codebase = addSlash(getURL(root, "codebase", base)); - this.base = (codebase != null) ? codebase : base; // if codebase not specified use default codebase + if (this.codebase == null) // We only override it if it is not specified. + this.codebase = codebase; + this.base = (this.codebase != null) ? this.codebase : base; // if codebase not specified use default codebase fileLocation = getURL(root, "href", this.base); // normalize the text nodes |