{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info icon This 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
Image of page 1

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

View Full Document Right 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 boxshadowdwn Why do we care about CGI, after all, hasn’t it has largely been overtaken by more advanced technologies? boxshadowdwn True; however, CGI illustrates several important points in the context of a nice simple standard: boxshadowdwn How values are passed from client environment to server (effectively parameters in Web application function calls) boxshadowdwn How data is encoded for transmission from client to server and back boxshadowdwn How forms hook into back-end requests boxshadowdwn Also, CGI remains useful for quickly throwing together dynamic serving of content that doesn’t justify use of an enterprise approach like Servlets boxshadowdwn We’ll look at some examples of how this is done
Image of page 2
40CGI 21 Oct 2010 CSCC09 Programming on the Web 3 40CGI CSCC09 Programming on the Web 5 CGI, An Example boxshadowdwn 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"; boxshadowdwn 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
Image of page 3

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

View Full Document Right 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.
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern