bilfurd has asked for the wisdom of the Perl Monks concerning the following question:

Does anyone have any experience with JavaCGIBridge?

The theory is to allow java applets to get data from Perl cgi scripts using HTTP GET/POST requests. The presentation makes it look like the perfect solution to a work project I have going, but I would like an informed opinion to back me up on this.

Thanks for your help!

Replies are listed 'Best First'.
Re: JavaCGIBridge
by djantzen (Priest) on Jan 10, 2003 at 05:50 UTC

    Perhaps a better question would just be whether anyone has experience passing GET/POST requests from a Java client. The code found in JavaCGIBridge.java isn't anything spectacular -- it simply uses the standard Java class libraries for manipulating URLs and wraps that into a multithreaded class. You can do this on your own with ease if you want to, or just plug in their code. It might be wise to find out what problems have been encountered since the code was originally developed five (!) years ago however.

    Another option is to use SOAP, which has good support in both Java and Perl, although that gets you into remote procedure calls which may be overkill for your application.

Re: JavaCGIBridge
by gjb (Vicar) on Jan 10, 2003 at 18:48 UTC

    I second fever's suggestion, especially given the simplicity of getting data via HTTP in Java. The code below is just a toy example of a program that takes an URL as a command line argument and prints the corresponding web page to standard out. This is the most simple minded approach, I'm sure one can do it much better, it's just a piece of code I'd around.

    import java.net.*; import java.io.*; public class HTTPclient { public static void main(String args[]) throws Exception { URL url = new URL(args[0]); URLConnection conn = url.openConnection(); char c; InputStream input = conn.getInputStream(); while((c = (char) input.read()) != -1) { System.out.print((char) c); } input.close(); } }
    Just my 2 cents, -gjb-