AS/400 Toolbox for Java includes proxy support for some classes. Proxy support
is the processing that AS/400 Toolbox for Java needs to carry out a task on
a Java virtual machine (JVM) when the application is on a different JVM. Proxy
support includes using the Secure Sockets Layer (SSL)
protocol to encrypt data.
Before proxy support, the classes containing the public interface, all the classes needed to process a request, and the application itself ran on the same JVM. When using proxy support, the public interface must be with the application, but classes for processing requests can run on a different JVM. Proxy support does not change the public interface. The same program can run with either the proxy version of AS/400 Toolbox for Java or the traditional version.
The goal of the multiple-tier, proxy scenario is to make the jar file as small as possible, so that downloading it from an applet takes less time. When you use the proxy classes, you don't need to install the entire AS/400 Toolbox for Java on the client. Instead, use AS400JarMaker on the jt400Proxy.jar file to include only the required components, which makes the jar file as small as possible.
The chart below compares the size of the proxy jar files with the traditional jar files:
An additional benefit is that proxy support requires you have to have fewer
ports open through a firewall. With traditional AS/400 Toolbox for Java, you
must have multiple ports open. This
is because each Toolbox service uses a different port to communicate with the
server.
For example, Command call uses a different port than JDBC, which uses a different
port than print, and so on. You must allow each of these ports through the firewall.
However, when using proxy support, all the data flows through the same port.
Two options
are available for running via a proxy: traditional proxy and HTTP tunneling:
java com.ibm.as400.access.ProxyServer -port 1234
AS/400 Toolbox for Java uses the proxy server name to determine if traditional proxy or tunneling proxy is being used:
com.ibm.as400.access.AS400.proxyServer=myServer
com.ibm.as400.access.AS400.proxyServer=http://myServer
When running traditional proxy, a socket connection exists between the client and server. If that connection fails, the server cleans up resources associated with that client. When using HTTP tunneling, using the HTTP protocol makes proxy connectionless. That is, a new connection is made for each data flow.
Because the protocol is connectionless, the server does not know if the client application is no longer active. Consequently, the server does not know when to clean up resources. The tunneling server solves this problem by using a thread to clean up resources at a predetermined interval (which is based on a timeout value).
At the end of the predetermined interval, the thread runs and cleans up resources that have not been used lately. Two system properties govern the thread:
The jt400Proxy.jar ships with the rest of the AS/400 Toolbox for Java. The proxy classes, like the other classes in the AS/400 Toolbox for Java, comprise a set of platform independent Java classes that can run on any computer with a Java virtual machine. The proxy classes dispatch all method calls to a server application, or proxy server. The full AS/400 Toolbox for Java classes are on the proxy server. When a client uses a proxy class, the request is transferred to the proxy server which creates and administers the real AS/400 Toolbox for Java objects.
The following picture shows how the traditional and proxy client connect to the AS/400. The proxy server can be the AS/400 that contains the data.
An application that uses proxy support performs more slowly than if it uses traditional AS/400 Toolbox for Java classes due to the extra communication needed to support the smaller proxy classes. Applications that make fewer method calls have less performance degradation.
To use the proxy server implementation of the AS/400 Toolbox for Java classes, complete the following steps:
java com.ibm.as400.access.ProxyServer
com.ibm.as400.access.AS400.proxyServer=myServer
com.ibm.as400.access.AS400.proxyServer=http://myServer
When you want to work with both the proxy classes and classes not in jt400Proxy.jar, you can refer to jt400.jar instead of jt400Proxy.jar. jt400Proxy.jar is a subset of the jt400.jar and, therefore, all of the proxy classes are contained in the jt400.jar file.
When using
proxy, three options are available for encrypting data as it flows from the
proxy client to the target AS/400 server. SSL algorithms are used to encrypt
data.
See Secure Sockets Layer for more information.
We have provided three
specific examples for using a proxy server with the steps listed above.
Some AS/400 Toolbox for Java classes are enabled to work with the proxy server application. These include the following:
Other classes are not supported at this time by jt400Proxy. Also, integrated file system permissions are not functional using only the proxy jar file. However, you can use the JarMaker class to include these classes from the jt400.jar file.