chapter 33 cgi technology for dynamic web documents n.
Download
Skip this Video
Download Presentation
Chapter 33 CGI Technology for Dynamic Web Documents

Loading in 2 Seconds...

play fullscreen
1 / 13

Chapter 33 CGI Technology for Dynamic Web Documents - PowerPoint PPT Presentation


  • 70 Views
  • Uploaded on

Chapter 33 CGI Technology for Dynamic Web Documents. There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents, these alternative forms allow computer programs to control the contents of a document dynamically.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Chapter 33 CGI Technology for Dynamic Web Documents' - vivian-charles


Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
chapter 33 cgi technology for dynamic web documents
Chapter 33 CGI Technology for Dynamic Web Documents
  • There are two alternative forms of retrieving web documents.
  • Instead of retrieving static HTML documents, these alternative forms allow computer programs to control the contents of a document dynamically.
  • In one form, a Web server runs an auxiliary program (CGI program) to create a document whenever a request arrives from a browser.
  • In the other form, a server provides the browser with a computer program (JAVA).
three types of web documents
Three types of Web documents
  • Static, dynamic, and active
  • categorized depending on when the information in the document changes
static documents
Static Documents
  • content of document is determined when document is written and remains unchanged until author revises document
dynamic documents
Dynamic Documents
  • document does not exist in a predefined form.
  • document is created by a web server whenever a browser requests the document.
  • When a request arrives, the Web server runs an application program that creates the dynamic document.
  • The server returns the output of the program as a response to the browser.
  • The contents of a dynamic document can vary whenever a server receives a request for the document
active document
Active Document
  • consists of a computer program that understands how to compute and display values.
  • When a browser request an active document, the server returns a copy of the program that the browser must run locally.
  • Information displayed can change after the document has been loaded into a browser.
common gateway interface cgi
Common Gateway Interface (CGI)
  • Standard is used for building dynamic Web documents.
  • specifies how a server interacts with an application program that implements a dynamic document.
  • The application is called a CGI program.
  • CGI does not specify a particular programming language ( eg. could be C, Perl , or Unix shell (fig 33.1))
cgi program output
CGI program output
  • can be an HTML document, a plain text file, or a graphics image.
  • A header (eg. Content-type: text/html ) (Content-type: text/plain) consists of line(s) of text describing the document type followed by a blank line, or a header can specify that the requested document is at a different location (eg. Location: /new/bar.txt <blank line>)
cgi application support
CGI application support
  • A server that is capable of running CGI programs must be configured before it can invoke a CGI program or script.
  • When the a browser contacts the server and request the specified URL, the server runs the CGI program
parameters and environment variables
Parameters and Environment Variables
  • browser can pass parameters to a CGI program via URL.
  • If the prefix of the URL corresponds to a CGI program, the server invokes the CGI program and passes the suffix of the URL as an argument.
  • The question mark character (?) in the URL separates the prefix from the suffix.
  • The server uses its configuration information to map the prefix to a particular CGI program.
  • The server passes everything after the question mark as an argument to the CGI program via environment variables instead of via command line
environment variables inherited by a cgi program
Environment Variables inherited by a CGI program
  • SERVER_NAME
    • contains domain name of computer running web server
  • GATEWAY_INTERFACE
    • contains version of CGI software server is using
  • SCRIPT_NAME
    • the path in the URL after the server name.
  • QUERY_STRING
    • contains information following “?” in the URL
  • REMOTE_ADDR
    • contains IP address of the computer running the browser that sent the request.
state information
State Information
  • Information preserved from one invocation of a CGI program to the next
    • helps avoid having a user answer questions repeatedly when specifying additional requests.
  • CGI program saves information between requests (state information) via one of two methods
  • for info that must be maintained across invocations of a browser, the CGI program uses files for long term storage (fig 33.3)
  • for info that must be kept only while a browser is running, a dynamic document program encodes such information in URLs that appear in the hypertext links in the document(fig 33.4)
server side scripting technologies
Server-Side Scripting Technologies
  • Alternative dynamic document technologies used when only a small portion of web page needs to be changed.
  • Interpreters built into web servers that can make small changes to a predefined template containing both HTML and scripts
  • Regular HTML passes through unchanged
  • Script information is replaced with output from interpreting the script
  • ASP, JSP, PHP, Cold Fusion