Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launching JNLP from a dotnet web application

Tags:

java

.net

jnlp

Oracle recommends using the JnlpDownloadServlet to launch JNLP from Java web applications - https://docs.oracle.com/javase/8/docs/technotes/guides/javaws/developersguide/downloadservletguide.html

However, I need to launch a JNLP application with a dynamically generated JNLP file from a dotnet application.

What would I need to do to enable this?

  • set content type as application/x-java-jnlp-file

  • output the JNLP file as a download.

Is there anything else?

like image 373
user93353 Avatar asked Nov 09 '22 08:11

user93353


1 Answers

The JNLP file is just an XML file that happens to be an executable file as long as you have Java Web Start installed on your machine. This is usually installed on a machine.

From a .NET Web Application point of view, you'd need to ensure the following:

  • Correct content-type (application/x-java-jnlp). You might need to add configuration to your .NET server to enable this mime type.
  • The file needs to be accessible via a URL (kind of obvious, but worth mentioning for completeness)
  • The file needs to be downloadable. Conceptually it is the same as returning any other file.
  • For seamlessness, the browser needs to be setup to automatically execute jnlp files. Sometimes company/default browser settings do not do this and you'd end up needing an extra click. Not a big deal, but just something to be aware of

In terms of "configuring"/implementing the actual serving of the JNLP file from a .NET Application:

  • Your end goal is that whatever JNLP file you return is executable with Java Web Start. This gives you a nice repeatable test while you're working on this.
  • You need to ensure that your .NET Application is able to serve the jar files needed by the JNLP application. Typically the codebase attribute and the resources element needs to reference your .NET application. The JNLP File Structure Page should help with this.
like image 60
Shiraaz.M Avatar answered Nov 14 '22 22:11

Shiraaz.M