ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahh_5.4.0.1/proxex2.htm

70 lines
4.5 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="Example: Running a Java applet using proxy support" />
<meta name="abstract" content="The following example shows you the steps to run a Java applet using proxy support." />
<meta name="description" content="The following example shows you the steps to run a Java applet using proxy support." />
<meta name="DC.Relation" scheme="URI" content="proxies.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="proxex2" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Example: Running a Java applet using proxy support</title>
</head>
<body id="proxex2"><a name="proxex2"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example: Running a Java applet using proxy support</h1>
<div><p>The following example shows you the steps to run a Java™ applet
using proxy support.</p>
<div class="section"><p> </p>
<ol><li>Choose a machine to act as the proxy server. Applets can initiate network
connections only to the machine from which they were originally downloaded;
therefore, it works best to run the proxy server on the same machine as the
HTTP server. The Java environment and CLASSPATH on the proxy server machine
includes the jt400.jar file.</li>
<li>Start the proxy server on this machine by typing: <samp class="codeph">java com.ibm.as400.access.ProxyServer
-verbose</samp> Specifying verbose will allow you to monitor when the client
connects and disconnects.</li>
<li>Applet code needs to be downloaded before it runs so it is best to reduce
the size of the code as much as possible. The <a href="jar.htm#jar">AS400ToolboxJarMaker</a> can
reduce the jt400Proxy.jar significantly by including only the code for the
components that your applet uses. For instance, if an applet uses only JDBC,
reduce the jt400Proxy.jar file to include the minimal amount of code by running
the following command:<pre> java utilities.AS400ToolboxJarMaker -source jt400Proxy.jar -destination jt400ProxySmall.jar
-component JDBC</pre>
</li>
<li>The applet must set the value of the com.ibm.as400.access.AS400.proxyServer
system property to be the name of your proxy server. A convenient way to do
this for applets is using a compiled Properties class (<a href="systempropertiessample2.htm#systempropertiessample2">Example</a>).
Compile this class and place the generated Properties.class file in the com/ibm/as400/access
directory (the same path your html file is coming from). For example, if the
html file is /mystuff/HelloWorld.html, then Properties.class is in /mystuff/com/ibm/as400/access.</li>
<li>Put the jt400ProxySmall.jar in the same directory as the html file (/mystuff/
in step 4).</li>
<li>Refer to the applet like this in your HTML file:<pre> &lt;APPLET archive="jt400Proxy.jar, Properties.class" code="YourApplet.class"
width=300 height=100&gt; &lt;/APPLET&gt;</pre>
</li>
</ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="proxies.htm" title="IBM Toolbox for Java includes proxy support for some classes. Proxy support is the processing that IBM 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</a></div>
</div>
</div>
</body>
</html>