views:

46

answers:

2

I have an application which is invoked via Java Webstart. Opening it via the Webstart link works without any issue.

I also have an application based on Excel that generates files (via vba) which can then be opened by the program that starts via Webstart.

What I would like to do is have a button that invokes the Webstart application and then opens a newly generated file. The files name (and contents) are time sensitive and so I can't use the same file name over and over.

I've pretty much figured out how to use vba to invoke the application via Webstart but the problem is that for the Webstart app to be able to open a file it needs to be passed in as an argument in the jnlp descriptor

<application-desc main-class="com.foo.WebstartApp">
    <argument>-file</argument>
    <argument>C:\files\file_20100909_164834.csv</argument>
</application-desc>

How do you go about passing through the filename into the JNLP file when the filename will always be different?

Should I be looking at dynamically generating a new jnlp file each time, or is there a way to parameterize the jnlp file and pass through the filename when invoking the JNLP?

+1  A: 

Dynamically generated JNLP files is probably going to open you up to injection attacks, just like dynamic SQL. Further it looks as if you are expecting the user to trust the WebStart application which trusts the JNLP file which is untrustworthy.

Assuming you have one application instance per desktop (SingleInstanceService), information about which files to use, which should not necessarily be trusted, can be passed through an applet using the PersistenceService ("muffins") or, apparently if the browser is IE, through cookies.

Tom Hawtin - tackline
This is for an internal website so I'm not worried about injection attacks
Pram
@Pram So long as you know what you are doing. Perimeter security is not considered adequate these days.
Tom Hawtin - tackline
.jnlp files can be signed if necessary
finnw
@finnw Not a great deal of use for dynamic JNLPs. Unless you have the code-signing certificate online, which is a big no-no.
Tom Hawtin - tackline
@Tom, it's not as bad if the private key is kept on a back-end server which is not publicly accessible. BTW +1 for mentioning muffins (if only to draw attention to their existence so people realise how evil they are.)
finnw
A: 

I've found a solution that suits my needs. A custom servlet is used to modify parameters in the URL string.

http://forums.sun.com/thread.jspa?threadID=714893

Pram