CGI (Common Gateway Interface)
The common gateway interface (CGI) is a standard way for a Web server to pass a Web user's request to an application program and to receive data back to forward to the user. These programs allow a Web developer to deliver dynamic information (usually in the form of HTML) via the browser. A CGI program can be written in any language, including Java that can be executed by your Web server.
The performance issues in the platform-dependent CGI programs let to the introduction of Servlets. Servlets are platform-independent. The main purpose of a servlet is to collect the request from the client and generate the requested web page dynamically for a corresponding request and send it back to the client. Java Servlets often serve the same purpose as programs implemented using the Common Gateway Interface (CGI).
Server has to create a new CGI process for every client request. For example, If 100 users are accessing the web application, and then the server has to create 100 CGI processes to handle the request made by them. Since a server has limited resources, creating new process every time for a new request is not a viable option, this imposed the limitation on server, due to that the server cannot handle more than a specified number of users at the same time. The CGI programs are memory intensive programs.
CGI Environmental Variables:
Environment
variables are a series of hidden values that the web server sends to every CGI
program you run.
Key |
Value |
HTTP_COOKIE |
The visitor's cookie, if one is set |
HTTP_HOST |
The hostname of the page being attempted |
HTTP_USER_AGENT |
The browser type of the visitor |
PATH |
The system
path your server is running under |
REMOTE_ADDR |
The IP
address of the visitor |
REMOTE_HOST |
The
hostname of the visitor |
REMOTE_PORT |
The port the visitor is connected to on the web server |
REMOTE_USER |
The visitor's username (for .htaccess-protected pages) |
REQUEST_METHOD |
GET or POST |
SERVER_NAME |
Your server's fully qualified domain name (e.g. www.cgi101.com) |
SERVER_PORT |
The port number your server is listening on |
No comments:
Post a Comment