Introduction
JWS is a client side technology through which one can launch the application both from a web browser and desktop. Before discussing about JWS in detail here are some points about desktop and web based applications.
Desktop vs. Web Applications
In earlier days, when Internet was not invented, people used to develop desktop applications. Best examples are Microsoft word and outlook. After Internet was invented people started developing web applications Example: Amazon site. A web application is launched through web browser there is no need to install the application in each and every desktop. This portability feature of the web applications dragged the client’s interest away from desktop applications. To use a desktop application the user has to install the application in the computer. Also if there is a new version released then installation process has to be repeated. As the web applications are deployed in a server and people access the application by requesting the server there is no need to install in individual computer. Even if there is any up gradation in the application, as it will be deployed in a centralized location (server), there is no need to install. Since web applications are accessed through internet there would be a security risk as malicious users can access it which is not a case with desktop application. The web application development depends on internet connectivity. The internet connectivity could lead to performance issues.
After considering the above points clients are demanding for applications that can run from both internet and desktop. In any point of view it’s not worth to develop an application with same functionality to run in different environments.
To solve this problem, Sun Microsystems has introduced Java Web Start, a client-side technology that enables Java applications to launch either from a desktop or from a Web browser. This eliminates writing two applications with same functionality to run in different environments and providing a good way to maintain Java applications.
Java Web Start is also written in Java so the software is platform independent. Whenever the user requests for the application JWS launches the latest code from the web and for the first time it creates a cache of the application in the local machine. The next time JWS launches the application from the local cache if the version in the cache is updated if not it downloads the updated version to the cache. JWS provides a utility called “Java Application Manager” it comes with different options like organizing the downloaded applications, clearing the cache of the downloaded applications, setting HTTP proxies.
Mechanism behind JWS:
After brief introduction about JWS three questions will pop up in our mind.
How JWS knows which application to launch?
How to launch application through JWS?
Is JWS application specific one?
To answer the first question, to launch any application JWS must know some application related properties or settings
• Normally web applications are zipped into a folder called JAR files and they are deployed in a specific path in the servers. When we request the browser for an application JWS should know the exact path and Name of JAR file.
• Applications are written in different Java versions so JWS should know on which Java version a particular web application runs.
These properties are configured in a XML file called Java Networking Language Protocol (JNLP) file. Using this file JWS obtains the necessary information related to the web application and launches the application. Normally client will be provided a link to the JNLP file and when this particular URL is requested for the first time, the following process occurs
• The Web browser runs the Java Web Start.
• Java Web Start requests the Web server and downloads the application to the local cache for the first time. Next time it would update the cache if there is a version difference in the application
• The necessary files to launch the application are downloaded to the local machine.
• Then JWS runs the downloaded application.
After this you would very well know the answer for second question. The answer for third question is no, JWS is not application specific. JWS can launch multiple applications.
JNLP in Detail:
As already said JNLP file is an XML file. It comes up with the following key elements.
• JNLP Element
• Information Element
• Security Element
• Resources Element
The JNLP Element has three attributes spec attribute, Codebase attribute, Href attribute. The code base attribute specifies the base URL. The Href attribute is a URL which is the exact location of the JNLP file.
The Information element has elements like home page of the application, description about the application, application title, icon element and offline-allowed element. The offline-allowed element says whether JWS can launch the application offline or not.
The security element specifies the permissions for the application. If the all-permissions element is written in the descriptor then the application can access the machine in which it is installed / downloaded.
The resources element gives the java files and the supporting libraries and the system properties that are part of the application.
So these elements define the JNLP file structure.
Conclusion
Java Web Start helps in launching and deploying Java applications from the Web and the desktop finally providing the clients with the advantages of both web based and desktop application. Clients are provided with variety of options for launching, updating, and managing Java applications. There is no burden for developers as well as for the company as they have to support one application instead of two applications for the same functionality. The core thing for JWS is a JNLP file which can be configured by the developer. Even JWS is a Java application which ultimately is platform independent.
Friday, March 20, 2009
Subscribe to:
Posts (Atom)