All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object
|
+----java.util.Observable
|
+----com.extropia.net.JavaCGIBridge
|
+----com.extropia.net.JavaCGIBridgeExtension
The main helper method subsets are as follows:
[1] Serialization Support. Applets can send serialized Objects to and from a Web Server. Typically this will be used with CGI programs written in Java or with Java Servlets. However, serialization can also be a useful way of storing an applet's state on the server. In this case, another language such as Perl can easily serve as a conduit through which the serialized objects are stored as files on the web server.
[2] fetch records support. Typically, you will get all the records at once with getParsedData() or use the observer interface to keep track of records as they are parsed on the fly. However, if the observer interface seems like it is too much overhead to set up, the fetchNextRecord() method provides an intermediate alternative to getting all the records at the end of the entire response and the overhead of setting up an observer interface in your applet.
[3] show document support. Mac Netscape 3.x and below have a bug in the showDocument method. The show document method here provides a cross-browser way of displaying other HTML pages. For more information on Cross-Browser Bugs, view the web site devoted to these topics at http://gunther.web66.com/crossjava/.
In addition, show document also supports passing the JavaCGIBridge form variables Hashtable data structure. JavaCGIBridgeExtension's showDocument() method will automatically URL encoded and add the form variables to the URL so that a CGI program can be called with the GET method from showDocument().
private static long _showDocCount
public JavaCGIBridgeExtension(String field,
String record,
String startData,
String endData)
public JavaCGIBridgeExtension()
public ByteArrayOutputStream getByteArrayOutputStream() throws IOException
public ObjectOutputStream getObjectOutputStream() throws IOException
Example Usage:
JavaCGIBridgeExtension jcbe = new JavaCGIBridgeExtension(); ObjectOutputStream oos = jcbe.getObjectOutputStream(); oos.writeObject(myFirstObject); oos.writeObject(mySecondObject); oos.close(); ObjectInputStream ois = jcbe.getObjectData(myURL);
public ObjectInputStream getObjectData(URL u) throws JavaCGIBridgeTimeOutException, StreamCorruptedException, IOException
It follows the same basic syntax of getRawData() and getParsedData() methods from the core JavaCGIBridge class.
public ObjectInputStream getObjectData(URL u,
Hashtable ht) throws JavaCGIBridgeTimeOutException, StreamCorruptedException, IOException
It follows the same basic syntax of getRawData() and getParsedData() methods from the core JavaCGIBridge class.
public Vector fetchNextRecord() throws JavaCGIBridgeTimeOutException
This method is useful for users who wish to retrieve results before the entire response has been sent from the Web Server yet without the programmatic overhead of using the observer interface. For example, you may want to start displaying the first 100 or so records of data to the user right away even if there may be a lot more records to retrieve eventually such as 10,000.
Please note that you should be aware that there are multi-threading concerns when using this method. If you are using JavaCGIBridgePool to manage your objects, then be aware that the JavaCGIBridge object delibrately does not set processing to IDLE at the end of processing when fetchNextRecord is being called. This behavior is activated by passing "true" to the callOneWay method.
Because it is not set to IDLE, JavaCGIBridgePool has no way of knowing that you are done with the objects. There are two ways to set the JavaCGIBridge object idle. The first and easiest way demonstrated below), is to simply iterate over fetchNextRecord() until it returns null (end of records). When it does this, the JavaCGIBridge will immediately be set to the IDLE state. The second way is to manually called setStatus(JavaCGIBridge.IDLE) yourself.
If you are not using JavaCGIBridgePool, then this need to set the object IDLE is not necesssary if you do not plan on reusing the object itself.
Example Usage:
Vector v;
JavaCGIBridgeExtension jcbe = new JavaCGIBridgeExtension();
// true is passed because we are fetching records after the
// one-way operation
jcbe.callOneWay(myURL, true);
while (null != (v = jcbe.fetchNextRecord())) {
// Do something with Vector v
}
public void showDocument(AppletContext ac,
URL u,
String target)
public void showDocument(AppletContext ac,
URL u,
String target,
Hashtable formVars)
In addition, you can pass a Hashtable with form variables which will be used to construct a URL encoded query string to append to the URL itself.
public void showDocument(AppletContext ac,
URL u,
String target,
Hashtable formVars,
boolean fixMacBug)
In addition, you can pass a Hashtable with form variables which will be used to construct a URL encoded query string to append to the URL itself.
All Packages Class Hierarchy This Package Previous Next Index