JNLP Technology:
JNLP is a XML based specification. The heart of
JNLP technology is a JNLP file. It is a XML file that describes the different
attributes used to describe the application. Shown below is a JNLP file with
a few attributes.
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+"codebase="http://server.com">
<information>
<title>Title</title>
<vendor>MY company</vendor>
<description>Demo Application</description>
<icon href="icon.jpg"/>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.3"/>
<jar href="lib/SwingSet2.jar"/>
</resources>
<application-desc></application-desc>
</jnlp>
The jnlp element is the root
element that has a set of attributes that are used to specify information that
is specific to the JNLP file. The information element describes
meta-information about the application like title, description, vendor etc. The
security element is used to request a trusted application environment, why
applications need to be trusted will be discussed later in the security section.
The resources element specifies
all of the resources that are part of the application, such as Java class files,
native libraries, and system properties. The last part of the JNLP file
defines the kind of application. It could be one of the following four options:
application-desc, applet-desc, component-desc, or installer-desc.
If an application-desc is defined in a JNLP file then it's
an application descriptor. The application-desc element describes the
application and the attributes required to invoke it.
<application-desc main-class ="SampleApplicationClass">
<agrument> arg1</agrument>
</application-desc>
The main-class is the java class file which contains the main
method that needs to be run. Any arguments that might be required may be passed
in the argument element.
When the applet-desc is defined in the JNLP file then it's
an application descriptor for an applet. The applet-desc tag takes the normal
parameters an applet would take.
Similarly when a Component-desc is defined in the JNLP file
it represents a component extension. A Component extension is used to represent
common components that can be shared between applications.
The last type is a installation file. Its called a installer
extension and it contains a installer-desc tag. This is used when a application
needs to be downloaded and installed for the first time.
Updates and Caching:
The JNLP application provides three different download
protocols by which the application on the client can be made current. The
first is the Basic
download Protocol which downloads resources without any version information. The
second is a
Version based Download protocol which identifies all resources by a URL and version Id.
In this case when the JNLP client starts up an application it sends the current
version to the server as part of the request. If the server has a newer version
it would download the newer version. The third protocol pertains to extensions where a URL
or a URL and version id can be specified to download
the Extension Descriptor. If only a URL is specified
the extension is downloaded using the Basic download
protocol. If a URL and a version is specified the
version based download protocol is used with a few
additional parameters. The extra parameters are used
to identify the extension type and the platform for
which it is needed.
JNLP also provides a facility of providing incremental updates.
When the server finds that the client already has a version on the local
machine and all it requires is a new version it sends an incremental upgrade
instead of the whole application thereby reducing download time.
A JNLP client can cache the application to make
it run faster in the subsequent runs. If an application is downloaded using the
basic download protocol it would download the application without a version. When
the application is downloaded a timestamp is downloaded on the client to keep
track of updates. In the version based download protocol timestamps are not stored
but the version would be part of the request.
When the request is made the JNLP client checks for the
version already existing in the cache and the version in the request. If they
match no download needs to be done.
Security:
The Java Web Start enforces the strict security
rules of the Java language. Like Java applets all Java Web Start applications
execute within the Java Sandbox. By default all applications are deemed to be
malicious and access to local resources is restricted. However applications can
be signed using security certificates to allow limited access to system
resources and files. This may not be of great benefit to Intranet users who
want to capitalize on the power of Java Web Start in a secure intranet. The JNLP
API provides for some basic operations which can be done without securing or
signing the application. Some of them are discussed
in the next section.
JNLP API:
Sun has included the Java Web Start in the download
for J2SE 1.4. It has introduced a new extension
package to include all the JNLP specific files called
the javax.jnlp.*.
The JNLP API contains a few important services that would be helpful for applications that would want to do some operations on the client that are not allowed by the security manager. This does not mean that the security manager is bypassed by the JNLP API. It provides for a platform independent mechanism to interact with the client resources after obtaining the permission of the client. Java Web Start displays a warning window when a operation outside the control of the sandbox is requested.
An object of the service required can be obtained
using the static lookup method of the ServiceManager
Class. The lookup method takes a String parameter
which is the string representation of the service name
and returns a handle to the service requested.
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|