How do I access JNLP URL query string parameters?
843802Mar 6 2006 — edited Jun 27 2006I apologize if I missed the answer, but my search on this forum reveals only dead-end posts in this area. In brief:
I would like to start my JNLP application using URL such as:
http://myhost:8080/my_app.jnlp?param=value
How can I access the query parameter: "param=value" from within my Java application?
To be more precise, I need to pass (command line) arguments to my application launched via JNLP protocols. Values for my arguments vary widely, hence I can NOT supply all possible "variations" of the JNLP file, each containing a different setup (as most replies to similar requests suggest), using:
<application-desc main-class="my.Main">
<argument>-param=value</argument>
</application-desc>
Same applies to using system properties - I can't generate a different jnlp file for each value.
When I invoke "javaws" directly, I can now use the -print or -open options, and indeed:
$ javaws http://myhost:8080/my_app.jnlp -open my_value
will deliver arguments "-open" and "my_value to my application.
Unfortunatley, I need to be able to do the same via URL, coming from dynamically generated HTTP.
It seems that the code in JnlpDownloadServlet goes thru quite a bit of hassle to preserve query parameters attached to my URL when expanding <jnlp> element such as:
<jnlp href="$$name">
However, I fail to find where I could get at the jnlp "href" value from my application, or any "other" means of accessing JNLP URL query parameter(s). Do I have to write my own JnlpDownloadServer, using some non-standard mechanism for migrating URL query parameters into the downloaded .jnl file? (see lopica unofficial FAQ)
On a related subject, when I drop a file on my JNLP application launch icon created by javaws (Windows XP, Java Web Start 1.5.6), javaws fails reporting "too many arguments". I was assuming that the whole purpose of -print and -open arguments was enabling drag-and-drop paradigm - but I must be missing somethting in that area as well.