Java and CGI/Perl Integration. 
Author Message
 Java and CGI/Perl Integration.

Hello.
I have a simple question.(I hope it's simple).

Does anybody know a relatively simple way of getting data from a cgi script
written
in perl to a Java applet?

The operation I am performing is relatively simple. I just need to pass
about 50 lines of ascii text back and forth between a perl cgi script and a
Java Applet.

Thank you.

I am going to check back. But if it is possible e-mail me a version of
reply. This is relativly urgent. I want to get a reply as soon as possible.

-----------------------
I am not naive, just open-minded.



Sat, 05 Oct 2002 03:00:00 GMT  
 Java and CGI/Perl Integration.

    public String getPerlCgiOutput(String server, String args) throws
getPerlCgiOutputException {
        InputStream in = null;  
        URL url = null;
        byte[] buffer = new byte[2048];
        int bytes_read=0;
        StringBuffer strbuf = new StringBuffer();

        try {
            url = new URL(server+"cgi-bin/perl.cgi?"+args);
            in = url.openStream();
            // read from the URL stream and append them to strbuf
            while((bytes_read = in.read(buffer)) != -1) strbuf.append(new
String(buffer,0));
            return (new String(strbuf);
       } catch(MalformedURLException MUE){ throw new
getPerlCgiOutputException("getPerlCgiOutput MUE="+MUE.toString);
       } catch(IOException IOE){ throw new
getPerlCgiOutputException("IOE="+IOE.toString());
       } catch(Exception E){ throw new
getPerlCgiOutputException("getPerlCgiOutputException E="+E.toString()); }
       finally {  // Always close the streams, no matter what.
           try { in.close(); } catch (IOException IOEX) { ; }
       }
    }

Quote:

> Hello.
> I have a simple question.(I hope it's simple).

> Does anybody know a relatively simple way of getting data from a cgi script
> written
> in perl to a Java applet?

> The operation I am performing is relatively simple. I just need to pass
> about 50 lines of ascii text back and forth between a perl cgi script and a
> Java Applet.
> ?
> ?

> japh - A Perl5 and Java Interface
> by Alligator Descartes

> http://www.symbolstone.org/technology/perl/japh/index.html
> ?
> ?

> --
> Anthony Bouvier
> Vagabond Programmer
> ?

-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
    The keeper of the Wastewater Engineering Virtual Library (WWEVL)
    the WWEVL URL == http://www.cleanh2o.com/
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-


Sun, 06 Oct 2002 03:00:00 GMT  
 Java and CGI/Perl Integration.
I doubt that it will work !
Try connecting to the server instead and use the get command !

try
{
    Socket S=Socket(Server,port);

Quote:
};

catch(Exception e)
{
   Do Something if error

Quote:
};

<Get the output and input stream of the socket object>

<write to the output stream the command get URL>

<On the server side the Perl script would be executed and the result would
be sent back to
  applet>
<From the input stream object read the data sent back from Web server>


    public String getPerlCgiOutput(String server, String args) throws
getPerlCgiOutputException {
        InputStream in = null;
        URL url = null;
        byte[] buffer = new byte[2048];
        int bytes_read=0;
        StringBuffer strbuf = new StringBuffer();

        try {
            url = new URL(server+"cgi-bin/perl.cgi?"+args);
            in = url.openStream();
            // read from the URL stream and append them to strbuf
            while((bytes_read = in.read(buffer)) != -1) strbuf.append(new
String(buffer,0));
            return (new String(strbuf);
       } catch(MalformedURLException MUE){ throw new
getPerlCgiOutputException("getPerlCgiOutput MUE="+MUE.toString);
       } catch(IOException IOE){ throw new
getPerlCgiOutputException("IOE="+IOE.toString());
       } catch(Exception E){ throw new
getPerlCgiOutputException("getPerlCgiOutputException E="+E.toString()); }
       finally {  // Always close the streams, no matter what.
           try { in.close(); } catch (IOException IOEX) { ; }
       }
    }

Quote:

> Hello.
> I have a simple question.(I hope it's simple).

> Does anybody know a relatively simple way of getting data from a cgi
script
> written
> in perl to a Java applet?

> The operation I am performing is relatively simple. I just need to pass
> about 50 lines of ascii text back and forth between a perl cgi script and
a
> Java Applet.

> japh - A Perl5 and Java Interface
> by Alligator Descartes

> http://www.symbolstone.org/technology/perl/japh/index.html

> --
> Anthony Bouvier
> Vagabond Programmer

-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
    The keeper of the Wastewater Engineering Virtual Library (WWEVL)
    the WWEVL URL == http://www.cleanh2o.com/
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-


Sat, 12 Oct 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Java and CGI/Perl Integration.

2. object serialization java/perl integration freezethaw

3. Perl/Java integration / socket programming

4. Java Perl Integration

5. Java/Perl integration - not free?

6. Integration between Perl and Java

7. Java and Perl integration

8. Java client to Java client via cgi/perl app

9. Help with integration problem between CGI Perl and JavaScript

10. Java Applet to Server CGI to Java Applet

11. Perl Conference notes by Gunther (Java frontend - perl cgi backend)

12. perl to java/ perl a java

 

 
Powered by phpBB® Forum Software