Web Application Trends

Revised 2015 Nov 201

TO DO

Introduction

Avoiding the Inefficiency of CGI

Servlets

The World Wide Web was born in 1990, at first with only static web pages; CGI came along in 1993.

Java (1995) gained popularity initially through applets, Java programs running in the web browser (client side). Servlets (1997) are the server-side counterpart.

With servlets, a Java interpreter runs within the web server (usually a special purpose web server such as Tomcat).

Advantages:

FastCGI

Advantages:

References:

mod_python, etc.

mod_python (ca. 2000) was developed for the Apache web server to avoid the cost of starting up the Python interpreter (starting a new process) for each CGI script run. Similar modules exist for some other languages, e.g., mod_php, mod_perl.

These Apache web server components (mod_python, mod_php, mod_perl); are similar to servlets, in that they run an interpreter in the web server.

Advantage:

Disadvantage:

WSGI

WSGI (Python Web Server Gateway Interface) is a newer interface which makes mod_python generally obsolete. There is a mod_wsgi for Apache httpd (which is officially Python 2 but maybe also supports Python 3). There are probably implementations for other web servers.

Example: we can use the Python 3 standard library’s WSGI-enabled HTTP server to run Listing 11–1 (p. 184) easily:

Web Frameworks

So far, we have considered alternatives to CGI that are designed to make more efficient use of the computer hardware. Programmers are another scarce resource that must be used efficiently. Web frameworks provide higher-level APIs, which can help programmers to work more productively. However, there is a start-up cost: the programmer must learn the web framework.

Web frameworks are also called “web application frameworks”, “web server frameworks”, etc.

WSGI provides a low-level API, so it is rarely used directly by web developers (as distinguished from web framework developers).

The Python web frameworks nowadays are built over WSGI, and since WSGI is a “standard” interface to web servers, it makes the web frameworks easier to use with a variety of servers.

Bottle

(We will skip the details of bottle in order to focus on Tornado, a slightly larger web framework for Python. Tornado will have its own page(s) of notes.)

However, bottle is a small (“micro”) web framework which we can use to demonstrate the most basic ideas.

More on Web Frameworks

Towards Greater Interactivity

Java and JavaScript enable programs to run in the web browser, avoiding the need to send a request to a server and wait for the server to respond.

Ajax (Asynchronous JavaScript and XML) allows the browser to exchange data with the server “in the background”; Comet enables the web server to push streaming data.

References


  1. Revisions:
    • 2015 Nov 20. Add “TO DO” section.
    • Version 2.2.3, 2015 Oct 26. Remove obsolete reference.
    • Version 2.2.2, 2014 Oct 30. De-emphasized bottle.
    • Version 2.2.1, 2013 Nov 30. Updated Top 10 security link.
    • Version 2.2, 2013 Oct 31.
    • Version 2.1, 2011 Nov 26. Added links to top 10 security risks and “HOWTO Use Python in the web”.
    • Version 2, 2011 Nov 17.
    • Version 1, 2011 Nov 10.