[Previous] [Contents] [Next] [IONA Technologies]


Chapter 10
Running OrbixWeb Clients


Contents

10.1 Running OrbixWeb Client Applications
10.2 Running OrbixWeb Client Applets
10.2.1 Loading a Client Applet from a File
10.2.2 Loading a Client Applet from a Web Server
10.2.3 Security Issues for Client Applets
10.3 Debugging OrbixWeb Clients
10.4 Possible Platform Dependencies in OrbixWeb Clients



This chapter deals with running OrbixWeb client applications and applets, and provides information on some general runtime issues for clients.

10.1 Running OrbixWeb Client Applications

The procedure for running an OrbixWeb client application is similar to the procedure for running any standalone Java application. In general, the user is required to fulfil three requirements:

The only runtime difference between an OrbixWeb application and a standard Java application lies in the first of these requirements. An OrbixWeb application must be able to access the classes stored in the IE.Iona.Orbix2 package. It also requires access to the classes produced in the compilation of IDL definitions which the application references. The IE.Iona.Orbix2 package is usually installed in the OrbixWeb classes directory.

The details of making class location information available to the Java interpreter are dependent on the Java development environment in use. However, it is generally necessary to indicate the location of the IE.Iona.Orbix2 package, the Java API classes, the IDL compiler output classes, and the application-specific classes. For example, if using the java interpreter from Sun Microsystems' JDK, the location of each should be added to the CLASSPATH environment variable (or specified in the -classpath switch).

Similarly, the details of running the application through the interpreter may differ between development environments. Again if using the JDK java interpreter, this can be done by passing the name of the class which contains the application main() method to the interpreter command, as follows:

10.2 Running OrbixWeb Client Applets

The requirements for running an OrbixWeb client applet are slightly more complex than those for running an application. To display a Java applet, it is generally necessary to reference the applet class in a HTML file (through the HTML <APPLET> tag) and then load this file into an applet viewer or a Java-enabled web browser. The runtime requirements for the applet depend on whether it is loaded directly from a HTML file or downloaded from a web server.

10.2.1 Loading a Client Applet from a File

When loading an OrbixWeb client applet from a file, the runtime requirements are similar to those for running a client application; it is necessary to do the following:

The second of these requirements often translates to setting the CLASSPATH environment variable appropriately before running the viewer or browser and loading the applet. This variable should usually include the location of the following: the classes of the IE.Iona.Orbix2 package, the Java API classes, the IDL compiler output classes, and the other applet-specific classes. When using a Java-enabled browser, the location of the Java API classes is generally not required.

When loading an OrbixWeb client applet from a file, it is also possible to specify a CODEBASE attribute on the HTML <APPLET> tag to specify the location of the required class files, as described in section 10.2.2.

10.2.2 Loading a Client Applet from a Web Server

If an OrbixWeb applet is loaded into a browser from a Web server, then it is not possible to specify access paths for the required Java classes at runtime. In this case, it is necessary to provide access (for example, via links) to all the classes the applet requires in a single directory. Then, rather than setting an environment variable, the CODEBASE attribute of the HTML flag <APPLET> could be used to indicate the location of the applet bytecode. For example:

Note that when using a Java-enabled Web browser to view an applet, it is not necessary to provide access to the Java API classes, as these will already be available.

10.2.3 Security Issues for Client Applets

The necessity of strict security restrictions in Java applets is well documented. There are two primary limitations on applets: no access to local file systems and limited network access. The former is imposed by Java and applies to all applets (no matter how they are loaded); the latter is generally imposed by Java-enabled browsers.

Applets are not given access to the file system of the host on which they execute: they can neither save files to the system nor read files from it. Any OrbixWeb client which is implemented as a Java applet must therefore obey this restriction.

In order to prevent the violation of system integrity, Web browsers often limit the network connectivity of applets which are downloaded from a Web server. Such applets can only communicate with the host from which they were downloaded.

This limitation has obvious implications for OrbixWeb client applets which are downloaded from Web servers. In particular, such clients can only communicate directly with OrbixWeb servers located on the host from which the clients themselves were downloaded. If this restriction applies to an OrbixWeb client applet, attempts by that client to bind to a server on an inaccessible host will raise a system exception of type IE.Iona.Orbix2.CORBA.COMM_FAILURE.

It is important to note that the exact details of applet security are dependent on the browser implementation and may exceed the restrictions described here. OrbixWeb developers should therefore consult their browser documentation for further information.

10.3 Debugging OrbixWeb Clients

An OrbixWeb client (application or applet) has the same fundamental characteristics as any other Java program. As such, OrbixWeb clients can be debugged with any available Java debugging tools (for example, the JDK jdb debugger).

When debugging OrbixWeb clients, it is especially important to be aware of Java exceptions thrown during OrbixWeb method invocations. OrbixWeb provides a set of system exceptions which indicate various categories of execution errors and these represent vital information for locating the source of invocation failures in a distributed application. These exceptions can be handled in client code by using Java try and catch statements. Similarly, they can be handled like standard Java exceptions when using a Java debugger.

More details on OrbixWeb integration with Java exceptions can be found in Chapter 12, "Exception Handling".

10.4 Possible Platform Dependencies in OrbixWeb Clients

In general, OrbixWeb clients are only dependent on the availability of a Java interpreter on the target execution platform. However, client programmers should be aware of two issues in client programming which may affect the platform-independence of an OrbixWeb system.

First, if a client depends on the OrbixWeb locator mechanism to find a target server, as described in Chapter 24, "Locators", then the client will require an OrbixWeb daemon to run on its local host. Otherwise, the server location mechanism will fail. This limits such a client to running on platforms where an OrbixWeb daemon is available.

Second, if a client uses the OrbixWeb _bind() method in order to create a proxy for a server object, then the _bind() call will fail unless an OrbixWeb daemon is available at the server host. Consequently, a client which uses _bind() will not execute successfully unless the target server is restricted to running on a host where an OrbixWeb daemon is available.



[Roadmap] [Introduction] [GS: Applications] [GS: Applets]
[IDL] [Mapping] [Programming OrbixWeb] [Publishing Objects] [Retrieving Objects] [IIOP]
[Running Clients] [Running Servers] [Exceptions] [Inheritance] [Callbacks] [Contexts]
[API Configuration] [TypeCode] [Any] [DII] [IR] [Filters] [Smart Proxies] [Loaders] [Locators]
[Index]