40cgi-2up - 40CGI 21 Oct 2010 Server-Side Programming: CGI...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
40CGI 21 Oct 2010 CSCC09 Programming on the Web 1 40CGI CSCC09 Programming on the Web 1 Server-Side Programming: CGI CGI interaction with Server, Metadata, CGI input, URL-encoding, CGI output 40CGI CSCC09 Programming on the Web 2 Dynamic Web Content • First generation Web servers provided primarily static, information-only HTML pages. • Problematic for sites that wished to allow users to interact with their sites • Needed: – dynamic server-side content generation – database interconnectivity – connection to existing legacy applications and new applications • CGI invented at NCSA (home of Mosaic browser, precursor to Netscape) to solve this problem
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
40CGI 21 Oct 2010 CSCC09 Programming on the Web 2 40CGI CSCC09 Programming on the Web 3 Dynamic Server Technologies • Common Gateway Interface (CGI) framework – typically used with dynamic scripting languages such as: Perl, Python; however, most languages will do • Code Embedded within HTML page: – Server-Side Includes (SSI) – PHP (scripts embedded in HTML) – JSP (Java embedded in HTML) – Microsoft Active Server Pages (ASP) (JScript embedded in HTML, non-precompiled) – Server-Side JavaScript (JavaScript embedded in HTML, precompiled), Netscape LiveWire • Java Servlets 40CGI CSCC09 Programming on the Web 4 CGI b Why do we care about CGI, after all, hasn’t it has largely been overtaken by more advanced technologies? b True; however, CGI illustrates several important points in the context of a nice simple standard: b How values are passed from client environment to server (effectively parameters in Web application function calls) b How data is encoded for transmission from client to server and back b How forms hook into back-end requests b Also, CGI remains useful for quickly throwing together dynamic serving of content that doesn’t justify use of an enterprise approach like Servlets b We’ll look at some examples of how this is done
Background image of page 2
40CGI 21 Oct 2010 CSCC09 Programming on the Web 3 40CGI CSCC09 Programming on the Web 5 CGI, An Example b go to hello.cgi This causes the execution of the perl script hello.cgi (below) #!/usr/local/bin/perl print "Content-type:text/html\n\n"; print "hello world!\n"; b Although our examples use Perl and Python, CGI scripts can be written in most common languages available on the Server, e.g. C, C++, VB, “shell” languages such as ksh, Ruby, Lisp, SmallTalk, etc. .. 40CGI CSCC09 Programming on the Web 6 CGI Model (Components) Clients: Web browsers e.g. IE, Firefox, Opera, Mozilla, Safari, etc. Web Server (WS): Apache, IIS, Netscape Enterprise, IBM Server, Tomcat, etc. CGI Protocol: specifies what a request/response looks like Handler programs: any executable residing on the web server
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
40CGI 21 Oct 2010 CSCC09 Programming on the Web 4 40CGI CSCC09 Programming on the Web 7 CGI Interaction • Client makes a request by specifying a URL plus additional info. • WS (named in URL) receives the request.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/09/2010 for the course CS CSCC09 taught by Professor Alan during the Spring '10 term at University of Toronto.

Page1 / 14

40cgi-2up - 40CGI 21 Oct 2010 Server-Side Programming: CGI...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online