generating the jnlp file on the fly

Hi all,

I have a working jnlp file with an embedded username and password arguments in the application-desc section that launches from my .shtml file (cited below). During development the username and password have been hardcoded into the .jnlp file but I want to be able to have a real user log in to the .shtml page and when they click on the .jnlp link I was hoping it could actually be a Perl/CGI script that would print the .jnlp file with the username and password slipped in. This is my first Web Start deployment and I am not sure it can be done the way I described.

Can the .jnlp link below (Launch MyApp) be changed to a .cgi link that will print the 'contents' of the .jnlp file with the real username and password substituted?

Thanks for your help.

hopi

<script language="JavaScript">

/* Note that the logic below always launches the JNLP application if

* the browser is Gecko based (Firefox). This is because it is not possible

* to detect MIME type application/x-java-jnlp-file on Gecko-based browsers.

*/

if (javawsInstalled || (navigator.userAgent.indexOf("Gecko") !=-1)){

document.write("<a href=http://mydomain.com/jawsdir/mywebstart/myapp.jnlp>Launch MyApp</a>

</li>");

document.write("<li><a href=http://mydomain.com/jawsdir/mywebstart/notepad.jnlp>Launch Notepad</a>

");

}else{

document.write("Click ");

document.write("<a href=http://java.sun.com/PluginBrowserCheck?pass=http://mydomain.com/jawsdir/mywebstart/jredownload.shtml&fail=http://java.sun.com/javase/downloads/index.jsp>here</a> ");

document.write("to download and install JRE, then launch MyApp");

}

</script>

[2165 byte] By [hopia] at [2007-11-27 2:57:57]
# 1
As long as you make sure the correct content type is returned to the browser you should be fine. But wouldn't you rather start the program and let your code ask for username and password?
riema at 2007-7-12 3:36:58 > top of Java-index,Desktop,Deploying...
# 2

I guess the users has already logged in the web-app. and the login should be taken over to the JWS app.

I did the same with Java Servlets, should be doable with CGI as well, I guess. I did adapt the JNLPDownloadServlet (see http://lopica.sourceforge.net/faq.html#servletsource ).

Depending on your level of security you may not want to write your plain text password into the JNLP file, because it may very well be saved on the client machine (and could be temptered in multi-user environments). For alternatives check out: http://grid.ncsa.uiuc.edu/papers/sws-myproxy-jws.pdf

HTH,

rio

rioriorio945a at 2007-7-12 3:36:58 > top of Java-index,Desktop,Deploying...