2. Beyond CGI and SSI
CGI is a simple mechanism for implementing portable server-side applications.
There are a number of problems associated with CGI processing. Its main deficiency
is performance. Processing a request that invokes a CGI script requires the
spawning of a child process to execute that script. Moreover, any initialization and
other processing that might be common to all requests must be repeated for every
single request.
SSI has similar deficiencies when its command processing employs CGI under the
hood. It adds the additional performance penalty by requiring servers to parse SSI
pages. Most importantly, SSI may represent a serious security risk, especially when
not configured carefully by the server administrator. The SSI mechanism is not
scaleable, and provides only limited opportunities for reuse.
3. Native APIs (ISAPI and NSAPI)
Efficiency concerns may be addressed by using native server APIs. A native
API is simply a mechanism providing direct ‘hooks’ into the Web server’s application
programming interface. Use of a native API implies the use of compiled code that is
optimized for use within the context of a specific Web server environment.
NSAPI and ISAPI are two approaches employed by Netscape’s Web server software
and Microsoft’s IIS, respectively. The problem is that there is no commonality or
consistency amongst these native APIs. They are different from each other, and
code written for one environment cannot be reused in another. This makes it
impossible to implement portable application
4. Fast CGI
FastCGI is an attempt to combine the portability of CGI applications with the efficiency of non-
portable applications based on server APIs. The idea is simple instead of requiring the spawning
of a new process every time a CGI script is to be executed, FastCGI allows processes associated
with CGI scripts to ‘stay alive’ after a request has been satisfied. This means that new processes
do not have to be spawned again and again, since the same process can be reused by multiple
requests. These processes may be initialized once without endlessly re-executing initialization
code.
Template processing
Another approach used to serve dynamic content involves the use of template processors. In
this approach, templates are essentially HTML files with additional ‘tags’ that prescribe
methods for inserting dynamically generated content from external sources. The template file
contains HTML that provides general page layout parameters, with the additional tags
discretely placed so that content is placed appropriately on the rendered page. Among the
most popular template approaches are PHP (an open source product), Cold Fusion (from
Allaire/Macromedia), and Active Server Pages or ASP (from Microsoft).
6. A better approach to serving dynamic content is the Servlet API—
Java technology for implementing applications that are portable
not only across different servers but also across different
hardware platforms and operating systems. Like FastCGI, the
servlet API uses server application modules that remain resident
and reusable, rather than requiring the spawning of a new
process for every request. Unlike FastCGI, the servlet API is
portable across servers, operating systems, and hardware
platforms. Servlets execute the same way in any environment that
provides a compliant servlet runner. The servlet API generated
very strong following; it is widely used in a variety of Web
server environments
Servlets
7. Java Server Pages
In contrast with earlier template approaches, most of which used proprietary tags,
JSP instructions are formatted as XML tags, combined with Java code fragments.
Together, these tags and code fragments express the logic to transform JSP pages into
the markup used to present the desired content. It is not necessary for all application
logic to be included in the page—the embedded code may reference other server-based
resources. JSP ability to reference server-based components is similar to SSI support for
referencing CGI scripts. It helps to separate the page logic from its look and feel and
supports a reusable component-based design