csciguy
csciguy

Reputation: 137

Passing arguments/parameters to jnlp over the web. What options are available?

Currently I have an app that is run via JNLP using Java web start. The user is able to hit a specific URL and launch this application just fine.

I'm able to add properties to the JNLP file itself inside of the build.xml (ant web start), by using j2seproperty tags, such as this.

<jw:j2se>

<j2seproperty name="testProperty" value="1"/>

</jw:j2se>

And these properties can be accessed anywhere in code via: System.getProperty("testProperty");

The problem is that I want to be able to set these properties via html, such as the following.

'http://localhost:8080/somelink?testProperty=2'

What are my options for achieving this? I've done some research and so far it seems that the only solution is to somehow dynamically create the JNLP launcher via a servlet of some sort.

Is this correct, and if not, are there other options here? If so, I'm open to all possibilities...

Upvotes: 5

Views: 3737

Answers (2)

Paul Gregoire
Paul Gregoire

Reputation: 9793

Another more flexible option is to embed an HTTP server using NanoHTTP and communicating with your JNLP app via Javascript or whatever you like.

Upvotes: 0

user207421
user207421

Reputation: 310926

Create the JNLP via a JSP page and have it fill in the property value from the request parameter. See this question for a slightly non-working example, but you should be able to fix it easily enough, I did.

Upvotes: 1

Related Questions