A More Detailed Example
Now, we are ready for launching something more interesting. First of all, let's move into the
wide-open sea: the Internet. We need to set up a Web server, as we have already explained, in
order to do so. Nevertheless, in the previous example, we saw how to deploy local JNLP appli-
cations, so if you don't want to get bothered with all these details, you can always adapt this
and the next examples to run locally with no Web server support at all. For this example, we
will deploy a little text editor application…well, a very minimal one.
Setting Up the Web Server MIME Type
What we need now is a basic Web server, accessible through the Internet or an intranet. In
Chapter 12, we will see how to set up a full-fledged JNLP-enabled Web server. Right now, we
are interested in showing the protocol with less overhead, so installing a Web server such as
Apache locally on your development platform will be OK. There is only one little trick you
need to do once the server is installed. You have to add a new MIME type on your Web server,
if it is not present yet. Check for the “ application/x-java-jnlp-file ”MIME type associ-
ated with .jnlp files. In Apache, for example, just check the types file in the conf directory. If
not present, add the new MIME type, being careful to correctly type the MIME type string.
If you don't have a Web server for development, you can download the Apache Web
server free of charge from the following address: http://www.apache.org/
Once you have added this new MIME type, the server can send JNLP files as files of the JNLP
type, not plain text files. The browser will invoke the proper plug-in program (our JNLP
Client) to execute the JNLP file.
We will use many of the tricks JNLP can offer to better integrate our applications in the client
computer. Furthermore, we want to add cute icons to our application and also read some con-
figuration files as well. All this has to be packed into JAR files that will be magically ready to
be used by our application on the Client, thanks to the JNLP Client.
What is new in the editor1.jnlp file (see Listing 8.4) is the presence of the description ele-
ment. This informs the JNLP Client of the text to show to users and of the icon element that
points to the application's icons.