IT427 Network Programming Seminar - Lecture 6, Nov. 16, 2000


Web Server Architecture

Web Server Architecture

 

Very simple basic model:

Server listens to Client request messages on the "well known" HTTP port (80) and return results.

Interaction is governed by the Hypertext Transfer Protocol RFC 1945, 2616.

Web Server is a daemon -- handles multiple requests simultaneously for the same client or for different Clients.

HTTP 
stateless

client/server:   request/response for single file so that the the specific page may require many requests. 

request:

server: 

response:

Small efficient programs generate the requested web page -> less chance to get outdated files -> more up-to-date information
Today: move to executable content.
         

 

CGI: Common Gateway Interface
(originally from gopher)

Some variables such as HTTP.USER.AGENT allow customization of web content to use specific client browser features.

CGI programs can be written in most languages. Typically: C, Perl, Schell-scripts, and Java as well. Originally: java myprog, ->

may crash, inefficient + slow, because:

New: Servlets

Server-side Java applications that dynamically produce HTML, do database queries, and integrate the two.

 

Use Servlets instead of CGI Scripts!

Servlets are an effective replacement for CGI scripts. They provide a way to generate dynamic documents that is both easier to write and faster  to run. Servlets also address the problem of doing server-side programming with platform-specific APIs: they are developed with the Java Servlet API, a standard Java extension.

Why not use RMI?

  1. Normal Java objects have public interfaces and they are instantiated every time one is needed. 

  2. Servlets have no defined interfaces. Java web server maps a request onto a servlet and passes the entire URL call. Servlet then creates the dynamic contend.

          

Servlet API:

public class ProductSearch extends HttpServlet {
    public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
                throws ServletException, IOException
         {...}

request object -> servlet -> response object -> server