[0001]
[0002]
[0003]
[0004]
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
// hi2CGI.java
// Compile using: $ javac "hi2CGI.java"
//
// 03-JUN-2000  MGD  make CGI header in line with other examples
// 03-SEP-1998  MGD  changes in line with JDK 1.1.6 final release
// 09-DEC-1997  MGD  initial
//
// Quick demonstration of using the CGIplus class for a "CGI" script.
// Can be invoked using ... http://host/cgiplus-bin/hi2cgi.class

import java.io.*;

public class hi2cgi {

   private static CGIplus cgienv = new CGIplus();

   public static void main (String args[]) {

      // CGI-compliant header line making document HTML (and pre-expired)
      System.out.print("Content-Type: text/html\n" +
                       "Expires: Thu, 01-Jan-1970 00:00:01 GMT\n\n");

      System.out.print("<H1><U>Hi &nbsp;" +
                       cgienv.getCgiVar("WWW_REMOTE_HOST") +
                       "</U></H1>\n" + 
                       "You are using \"<B>" +
                       cgienv.getCgiVar("WWW_HTTP_USER_AGENT") +
                       "</B>\"\n<P>It\'s currently <B>" +
                       cgienv.getCgiVar("WWW_REQUEST_TIME_LOCAL") +
                       "</B> here at <B>" +
                       cgienv.getCgiVar("WWW_SERVER_NAME") +
                       "</B>");
   }
}