[re]FastCGI with JDK 1.1.1

Stanley Gambarin (gambarin@OpenMarket.com)
Fri, 04 Apr 1997 15:23:30 -0500

Message-Id: <199704042023.PAA03942@u4-138.openmarket.com>
To: fastcgi-developers@OpenMarket.com
Subject: [re]FastCGI with JDK 1.1.1
Date: Fri, 04 Apr 1997 15:23:30 -0500
From: Stanley Gambarin <gambarin@OpenMarket.com>

Hi, I've been trying to use a JDK 1.1.1 program as an
ExternalAppClass.  In FCGIInterface, the variables System.in, .out,
and .err are set to streams connected to the newly arrived request. 
However, it seems that in JDK 1.1.1, these variables are declared
final, and the assignment fails.

This would seem to prevent the desired property, previously achieved
by FCGIInterface, that the same Java program could be used as either
CGI or FCGI.  How do you plan to modify the FCGI java classes to work
with JDK 1.1.1?

	You are correct that these streams have been renamed as
final and thus the currently provided functionality will not work
under JDK 1.1.1.  Since the original purpose of the Java port was to
demonstrate that FastCGI can be ported to almost any other programming
language, there are no plans to accomodate the Java port to JDK 1.1.1
However, if you would like to change the interface yourself and then 
supply us with the changes, I will be more than glad to incorporate these
changes into the FDK.  A couple of suggestions on possible ways to attack
the above problem:
	- we would like to provide a single interface for both CGI and FCGI.
	- we can not use the System.in, err, out since they are declared final.

	- solution: 
	Change the current signature of FCGIaccept() function in FCGIInterface
to return a class as a returning value.   This class will contain 3 members,
such as in, err, out.  (call this class FCGIio)  Then, all current calls to
System.out.println must be changed to FCGIio.out.println, and so on.
	Now, to allow for both CGI and FCGI, inside FCGIaccept() function, 
do the following :
	if (CGI)
		FCGIio.in = System.in;

	else if (FCGI)
		FCGIio.in = however it works right now...

	Note, that such changes are relatively minimal and will be portable
for both JDK1.1.1 and prior.  Also, not a lot needs to be changed, except
changing all occurrences of System to FCGIio, which can be done in 2 lines
of Perl code :).  The only thing that will change is the signature of 
the FCGIaccept() function.

						Hope that was of some help.