CGI

Accessing the CGI Standard Variables

CGI - Common Gateway Interface allows execution of several types of programs and is  collection of information about the current request.

Information is collected for HTTP request header or thru sockets by connecting to the requesting host.

ShowCGIVariables.java is a code example from a set of tutorials from CoreServlets.com showing how to access CGI variables.

Following is the collection of CGI Variables

AUTH_TYPE   - Gives authorization type in Authorization header, if one is available(basic or digest.)
CONTENT_LENGTH  - For POST Requests only. Size in Bytes indicating the size of data in POST.
CONTENT_TYPE    - designate the MIME Type of attached data.
DOCUMENT_ROOT   - Provides name of the real directory corresponding to the URL
HTTO_XXX_YYYY   - gives information on HTTP Request header
PATH_INFO   - gives path information attached to the URL after the address of the servlet - but before query data
PATH_TRANSLATED - gives path information mapped to the real path on the server
QUERY_STRING    - Provides raw data in the servlet
REMOTE_ADDR     - Indicates the IP Address of the client that made the request
REMOTE_HOST - Indicates fully qualified Domain name
REMOTE_USER - If authorization header is available, then the user information accessed can be used for session tracking
REQUEST_METHOD  - gives information on the method type.
SCRIPT_NAME     - gives path to the servlet name
SERVER_NAME     - host name
SERVER_PORT     - information about the port that the server is listening on
SERVER_PROTOCOL - gives protocol name and version egHTTP/1.0 or 1.1
SERVER_SOFTWARE - information about webserver