Jan K. Labanowski: "Tomcat, servlets, JSPs and other friends"

Commong Gateway Interface

Most popular approach:

  • server receives request to execute a file (e.g., C program or perl script). Server knows that the file should be executed rather than returned, since it is in a special directory or has a special extension.
     
  • server starts a new process (forks a new shell, and runs the file) with parameters given on the command line (the GET method), or sent to the program as STDIN (POST method).
     
  • The program send output to STDOUT, and this output is sent back to the browser (with the addition of the few response header lines, e.g., Content-Length).
     
  • External program dies, and if needed again, the whole process has to start again.
     
Very taxing on computer... Each request is requires starting a new program.