Chapter 13 Creating CORBA-Compatible Java Clients
This section describes how to deploy Java applets and applications, and lists the classes required by the Jaguar Java client ORB.
To deploy a Java applet, you must create an HTML page that loads the applet. The HTML file and all classes used by the applet must be made available for download from the Web server. Typically, you create a Java archive (JAR) file that contains all required classes, and then reference the JAR file from the HTML page. You can also copy the required classes to the Web servers class tree. (For Jaguar, the class tree is the html/classes directory).
Building a JAR file containing all necessary classes usually offers better performance than specifying a code base directory, since the client opens only one connection to download all classes that are required. When classes are downloaded individually, Web browsers typically open multiple connections to download each class, and performance suffers, compared to the single JAR file download. Some development tools, such as PowerJ, can determine class dependencies and create a JAR file for you. If you create a JAR file manually, add the classes listed in "Required classes".
You must also decide whether to deploy the HTML page and the applet on Jaguar's built-in Web server or on another Web server. Deploying both HTML and class files on Jaguar is the simplest scenario, unless your HTML page requires dynamic HTML, server-side includes, or other features that are not supported by Jaguar's HTTP server. In this case, you must deploy the HTML on a separate Web server and the classes on Jaguar. Since the classes are on a separate server, you must use a full URL with host and port names when specifying the code base in your HTML file. For example:
<applet
codebase="http://agogo:8080/classes"
code="Sample/Demo/MyClient.class">
</applet>
In this example, the applet classes will be downloaded from another server that accepts HTTP requests on the machine agogo at port 8080. You must deploy the applet's Java package directories and class files under that directory.
Beware of the security constraints on the network connections made by your applet. By default, applets cannot open network connections to hosts other than the host from which they were downloaded. If necessary, end users can reconfigure their browsers and change the security constraints. In practice, it is easier to deploy applications that work within the default security constraints rather than asking end users to change their configuration. You will have no problems if your applet classes are downloaded from Jaguar and connect back to the same Jaguar server.
If your end users are connecting to the Jaguar server through
a corporate firewall, HTTP tunnelling may be required. Some firewalls
do not allow IIOP connections. As described in "HTTP tunneling support", the Jaguar Java
ORB performs tunnelling automatically when required. If you are
certain that tunnelling is required, you can set the com.sybase.CORBA.http
property to true
so
that connection attempts do not try IIOP before switching to HTTP-tunnelled
IIOP.
If your applet connects to a secure IIOP port, you must make sure that the deployment server is configured with the necessary certificates to allow SSL connections to be made from your applet to the Jaguar server.
To deploy a Java application, you can create a JAR file that contains all classes required to run the application. Users can copy this file to their machine, add its location to the CLASSPATH system variable, and then run the application with the JDK Java interpreter. You may want to supply a script that configures the environment and runs your application with any required command-line parameters.
The JAR file must contain the classes listed in "Required classes".
In addition to the classes that implement your client program, you must ensure that the classes below are deployed with your applet or application.
Bcd
com/sybase/CORBA
com/sybase/CORBA/bcd
com/sybase/CORBA/hex
com/sybase/CORBA/http
com/sybase/CORBA/iiop
com/sybase/CORBA/jdbc102
com/sybase/CORBA/jdbc11
com/sybase/CORBA/utf
Mjd
org/omg
SessionManager
TabularResults
com/sybase/jaguar/jndi
javax
Copyright © 2000 Sybase, Inc. All rights reserved. |