Skip to content Skip to sidebar Skip to footer

Writing Cgi Script In Java

I trying to figure out how to write CGI scripts in Java. I followed this examples -> http://www.javaworld.com/jw-01-1997/jw-01-cgiscripts.html?page=1 It provide cgi_lib.java, he

Solution 1:

The contents of hello.cgi is shown at the top of page 2 of the article.

#!/bin/sh
java     -Dcgi.content_type=$CONTENT_TYPE     -Dcgi.content_length=$CONTENT_LENGTH     -Dcgi.request_method=$REQUEST_METHOD     -Dcgi.query_string=$QUERY_STRING     -Dcgi.server_name=$SERVER_NAME     -Dcgi.server_port=$SERVER_PORT     -Dcgi.script_name=$SCRIPT_NAME     -Dcgi.path_info=$PATH_INFO   hello

Solution 2:

The article says that you will execute the java jar from within a cgi script. You need to make sure that this script is set up to execute your jar file by making the correct calls to the java executable with your hello.jar file as the parameter. Also make sure your web server is configured correctly to allow the execution of cgi scripts.

Solution 3:

You also have to chmod of your cgi and java files so others can execute them.

Post a Comment for "Writing Cgi Script In Java"