Applets

JMS client applets are written in exactly the same way as normal JMS client applications are written. Browser security restrictions allow unsigned applets to establish connections only with the machine from which the applet is downloaded, in other words, the web server machine. Unlike normal applications (which can connect to a JMS server running on any machine), unsigned applets are allowed to connect only to the machine from which the applet is downloaded.

However, signed applets are allowed to connect to any host to which the web client has authorized access by the certificate provider. The web client can set different levels of permissions for certificates from different certificate vendors and may sometimes deny an applet permission to execute. In such cases, a signed applet carrying a certificate automatically invokes a window on the web client, asking if the user is interested in granting the applet the requisite permissions to execute. Using the advanced security options of popular browsers such as Netscape and Internet Explorer, one can explicitly set security parameters for all certificate holders.

Note 

We are not going to look at how to develop signed applets as it is tangential to what we're trying to explain here.

In this section we are going to embed an unsigned applet into a web browser and deploy it on a web server so that client applications can download the page from a web server and execute it from their web browser.

Running the TellerPanel Class as an Applet

Messaging brokers may provide a reduced run-time library for applet support. This run-time library may be architected to allow it to be plugged in by simply including it in the CLASSPATH variable on the file system, or the ARCHIVE tag in a web browser.

The run-time archive used for developing this applet contains all the classes representing FioranoMQ's implementation of JMS. This archive is 100% JMS 1.0.2 compliant. It includes implementation of all the Pub/Sub and PTP functionality. You can therefore modify these applets to work with any other 100% JMS 1.0.2 compliant vendor product. While doing so, make sure that you substitute fmprtl.zip (the client runtime of FioranoMQ) with the client runtime of your specific vendor.

The following listing is for a simple applet demonstrating the usage of JMS APIs from within an applet served from a web server. This applet sends the messages that the user keys in to the queue:

     <HEAD>      <BODY>       <CENTER>        <OBJECT         class         WIDTH = 400 HEIGHT = 310         codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-     win32.cab#Version=1,3,0,0">         <PARAM NAME = CODE VALUE = "ptp.onlinebanking.TellerPanel.class">         <PARAM NAME = CODEBASE VALUE = "../../" >         <PARAM NAME = ARCHIVE VALUE = "fmprtl.zip, jndi.jar" >         <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">         <PARAM NAME="scriptable" VALUE="false">        </OBJECT>       </CENTER>      </BODY>     </HEAD> 

Before we execute the applet, let's start up a couple of account department modules so that we see everything working together and communicating through the JMS messaging server. The teller module embedded in the applet served out from a web server will be communicating with a couple of accounts department modules from Bank1000 and Bank2000 through the JMS messaging server as shown in the figure below:

click to expand

Before doing anything else, make sure the FioranoMQ server (or other messaging server) is up and is ready to send and receive messages. Realize that if the server is not up, we may not be able to either send or receive messages. We can now compile all the files and run the Teller module.

Important 

For FioranoMQ users, the CLASSPATH should contain fmprtl.zip, and jndi.jar. These files can be found in the %FMP_DIR%\lib directory, where %FMP_DIR% refers to directory file path where you have installed your FioranoMQ Server.

Deploy the web page containing the TellerPanel applet on a web server. Now, start up a couple of accounting panel applications and the web server as shown below:

click to expand

Once the accounting department panels are up, go to the first accounting panel, click on the Item Choice and select BANK1000. On the other accounting panel, click on the Item Choice and select BANK2000.

The screenshots below show the accounting panels for BANK1000 and BANK2000 running as standalone Java applications:

click to expand

Now bring up the web browser and in its URL, enter the location of the web page containing the TellerPanel applet. In my case, it was http://localhost:8080/ptp/onlinebanking/OnlineBanking.html. Once the page comes up, clear the login screen by entering some information and connecting to either the BANK1000 or the BANK2000 accounting department and clicking the Submit button. Exercise all the options available.

The screenshot below shows the page served from a web server running the TellerPanel embedded as an applet:

click to expand



Professional JMS
Professional JMS
ISBN: 1861004931
EAN: 2147483647
Year: 2000
Pages: 154

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net