Java/FastCGI

Steve Harris (harris@openmarket.com)
Mon, 01 Jul 1996 16:51:38 -0400

Message-Id: <199607012051.QAA29189@squaw-valley.openmarket.com>
To: baggi@txt.it
Subject: Java/FastCGI
Date: Mon, 01 Jul 1996 16:51:38 -0400
From: Steve Harris <harris@openmarket.com>

There are two different examples In the first you run TinyFCGI as a FastCGI 
program TinyFCGI.cgi is not used in this case. In the second you use 
TinyFCGI.cgi to run TinyFCGI as a CGI (but not a FastCGI) program. The point 
of the second example is just to show that you can run the same code in both 
contexts.

To run TINYTFCGI as FastCGI, you start TinyFCGI.class with the "java 
DFCGI_PORT=portNum TinyFCGI" invocation.  To run TINYTFCGI as CGI you use 
TinyFCGI.cgi to run TinyFCGI.class. TinyFCGI.cgi invokes the java interpreter 
without providing an  FCGI_PORT parameter. The FastCGI intialization routine 
tests for the existence of an FCGI_PORT parameter to determine if the program 
is running as FastCGI. 

To run TinyFCGI as a FastCGI program using cgi-fcgi, you need to follow the 
instructions in the documentation, but in place of the 
ExternalAppClass/Responder, you run a CGI script file containing:

         #!../cgi-fcgi/cgi-fcgi -f
         cgi-fcgi -bind -connect hostName:portNum

Naturally the path to the cgi-fcgi binary might vary
according to the installation.  And the script file must
be executable in the Unix sense.

You would then point your browser at hostname/path/TinyFCGI.
If hostname contains a port, it is the port for that server, not the FCGI_PORT.

See cgi-fcgi.1 for more information.

In the case where you are runnning TinyFCGI as CGI (not FastCGI), you don't 
start the application externally, but you need only point your browser at 
TinyFCGI.cgi which is:

#! /bin/csh 
exec javexe/java TinyFCGI

The first line creates a shell, and you should make sure that the shell you 
invoke has CLASSPATH defined for fcgi-devel-kit/examples and 
fcgi-devel-kit/java/classes. The second line uses a soft link "javexe" to 
java/bin invoke the Java interpreter. You need to make this reference java/bin 
in your JDK. If the shell you use has this directory in its PATH, you can 
dispense with "javexe".

I hope this helps. If you have further problems let me know.



------- Forwarded Message
Date: Mon, 01 Jul 1996 18:13:21 +0200
From: Baggi Marco <baggi@txt.it>
Organization: TXT II
X-Mailer: Mozilla 2.0 (X11; I; SunOS 5.4 sun4c)
Mime-Version: 1.0
To: owner-fastcgi-developers@OpenMarket.com
Subject: FastCGI & Java
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I'm working for implementing Java Fast-CGI, but I have some problem.

I followed all the steps in the related chapter, but the example
TinyFCGI doesn't run.

How can I configure the port for open the Socket with cgi-fcgi ?

The execution of the program with java interpreter must be inside the
TinyFCGI.cgi or directly with an on-line command ?

How can I point my browser for view the results ? ( on my opinion the
example in the chapter is wrong !)

Thanks, if you can help me !

MB