java cgi how to 1998.pdf

(116 KB) Pobierz
Java CGI HOWTO
Java CGI HOWTO
Java CGI HOWTO
Table of Contents
Java CGI HOWTO. ............................................................................................................................................1
by David H. Silber javacgi−document@orbits.com. ...............................................................................1
1. Introduction. ..........................................................................................................................................1
2. Setting Up Your Server to Run Java CGI Programs (With Explanations). ..........................................1
3. Setting Up Your Server to Run Java CGI Programs (The Short Form). ..............................................1
4. Executing a Java CGI Program. ............................................................................................................1
5. Using the Java CGI Classes.. ................................................................................................................2
6. Future Plans. .........................................................................................................................................2
7. Changes. ................................................................................................................................................2
1. Introduction. ..........................................................................................................................................2
1.1 Prior Knowledge. ...............................................................................................................................2
1.2 This Documen. ..................................................................................................................................3
1.3 The Package. ......................................................................................................................................3
1.4 The Mailing List. ...............................................................................................................................3
2. Setting Up Your Server to Run Java CGI Programs (With Explanations). ..........................................3
2.1 System Requirements. .......................................................................................................................4
2.2 Java CGI Add−On Software. .............................................................................................................4
2.3 Unpacking the Source. .......................................................................................................................4
2.4 Decide On Your Local Path Policies. ................................................................................................4
2.5 Testing your installation.. ..................................................................................................................5
3. Setting Up Your Server to Run Java CGI Programs (The Short Form). ..............................................5
4. Executing a Java CGI Program. ............................................................................................................5
4.1 Obstacles to Running Java Programs Under the CGI Model. ...........................................................6
You can't run Java programs like ordinary executables.. ...........................................................6
Java does not have general access to the environment.. .............................................................6
4.2 Overcoming Problems in Running Java CGI Programs. ...................................................................6
The java.cgi script. .....................................................................................................................6
Invoking java.cgi from an HTML form. ....................................................................................7
5. Using the Java CGI Classes.. ................................................................................................................7
5.1 CGI.. ...................................................................................................................................................7
Class Syntax.. ..............................................................................................................................7
Class Description. .......................................................................................................................7
Member Summary. .....................................................................................................................8
See Also. .....................................................................................................................................8
CGI(). ..........................................................................................................................................8
getNames(). .................................................................................................................................8
getValue(). ..................................................................................................................................9
5.2 CGI_Tes. ...........................................................................................................................................0
Member Summary. .....................................................................................................................0
See Also. .....................................................................................................................................0
main(). .........................................................................................................................................0
5.3 Email. .................................................................................................................................................0
Class Syntax.. ..............................................................................................................................0
Class Description. .......................................................................................................................0
Member Summary. .....................................................................................................................0
See Also. .....................................................................................................................................0
Email(). .......................................................................................................................................0
i
22953193.001.png
Java CGI HOWTO
Table of Contents
send(). .........................................................................................................................................0
sendTo(). .....................................................................................................................................0
subject(). .....................................................................................................................................0
5.4 Email_Test. ........................................................................................................................................0
Member Summary. .....................................................................................................................0
See Also. .....................................................................................................................................0
main(). .........................................................................................................................................0
5.5 HTML. ...............................................................................................................................................0
Class Syntax.. ..............................................................................................................................0
Class Description. .......................................................................................................................0
Member Summary. .....................................................................................................................0
See Also. .....................................................................................................................................0
HTML(). .....................................................................................................................................0
author(. .......................................................................................................................................0
definitionList(). ...........................................................................................................................0
definitionListTerm(). ..................................................................................................................0
endList(). .....................................................................................................................................0
listItem(.. ....................................................................................................................................0
send(). .........................................................................................................................................0
title(. ...........................................................................................................................................0
5.6 HTML_Test. ......................................................................................................................................0
Member Summary. .....................................................................................................................0
See Also. .....................................................................................................................................0
main(). .........................................................................................................................................0
5.7 Text. ...................................................................................................................................................0
Class Syntax.. ..............................................................................................................................0
Class Description. .......................................................................................................................0
Member Summary. .....................................................................................................................0
See Also. .....................................................................................................................................0
add(). ...........................................................................................................................................0
addLineBreak(). ..........................................................................................................................0
addParagraph(). ...........................................................................................................................0
6. Future Plans. .........................................................................................................................................0
7. Changes. ................................................................................................................................................0
7.1 Changes from 0.4 to 0.5. ....................................................................................................................0
7.2 Changes from 0.3 to 0.4. ....................................................................................................................0
7.3 Changes from 0.2 to 0.3. ....................................................................................................................0
7.4 Changes from 0.1 to 0.2. ....................................................................................................................0
ii
22953193.002.png
Java CGI HOWTO
by David H. Silber javacgi−document@orbits.com
v0.5, 1 December 1998
This HOWTO document explains how to set up your server to allow CGI programs written in Java and how
to use Java to write CGI programs. Although HOWTO documents are targetted towards use with the Linux
operating system, this particular one is not dependant on the particular version of unix used.
·
·
·
·
Java CGI HOWTO
1
·
·
·
22953193.003.png
Java CGI HOWTO
·
·
·
·
7. Changes
·
·
Because of the way that Java is designed the programmer does not have easy access to the system's
environment variables. Because of the way that the Java Development Kit (JDK) is set up, it is necessary to
use multiple tokens to invoke a program, which does not mesh very well with the standard HTML forms/CGI
manner of operations. There are ways around these limitations, and I have implemented one of them. Read
further for details.
Since I wrote the previous paragraph in 1996, there have been many changes in the Java technology. It is
likely that a better solution to running server−side Java programs is now available −− perhaps you should
take a look at servlets.
1.1 Prior Knowledge
I am assuming that you have a general knowledge of HTML and CGI concepts and at least a minimal
knowledge of your HTTP server. You should also know how to program in Java, or a lot of this will not
make sense.
5.Using the Java CGI Classes.
2
·
22953193.004.png
Zgłoś jeśli naruszono regulamin