servlets
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
servlets [2007/10/08 16:48] – roumani | servlets [2008/02/04 19:05] (current) – roumani | ||
---|---|---|---|
Line 2: | Line 2: | ||
This lecture covers the JEE's approach to server-side processing. It introduces the overall Tomcat architecture and focuses on the servlet container. The hands-on lab session will walk you through the installation of Tomcat and introduces you to the capabilities of its three engines, Coyote, Catalina, and Jasper. | This lecture covers the JEE's approach to server-side processing. It introduces the overall Tomcat architecture and focuses on the servlet container. The hands-on lab session will walk you through the installation of Tomcat and introduces you to the capabilities of its three engines, Coyote, Catalina, and Jasper. | ||
+ | |||
+ | |||
===== Outline ===== | ===== Outline ===== | ||
+ | |||
+ | == The Architecture == | ||
+ | * Tomcat = Coyote + Catalina + Jasper. It is a reference implementation of Sun's Servlet/JSP standards. | ||
+ | * Coyote is a connector, Catalina is a servlet container, and Jasper is a JSP compiler. | ||
+ | * Client uses HTTP to reach a Web Server which has a module (Apache) or a plug-in (IIS) for JK filtering. | ||
+ | * The web server uses NFS to serve static files, CGI to run scripts out of process, or the JK protocol to contact Coyote in process. | ||
+ | * You supply your servlet subclass to Catalina and it handles the request. | ||
+ | * Coyote today comes with an HTTP version that bypasses the JK protocol; i.e. it acts as a web server with NFS, CGI, and SSI. Hence, the whole system is self-contained and 100% Java. | ||
+ | * To enable MVC, servlets are used as controllers, | ||
+ | |||
+ | == The Life Cycle == | ||
+ | * Server makes one instance of your servlet | ||
+ | * It invokes the '' | ||
+ | * It creates a pool of threads ready to invoke your servlet' | ||
+ | * When a client connects, a thread is (randomly) chosen and assigned to serve this request. | ||
+ | * There is no client-to-thread mapping: the same client may get served by the same or a different thread. | ||
+ | * When it is time to stop this servlet, the server invokes its '' | ||
+ | |||
+ | == The API == | ||
+ | * No need to override '' | ||
+ | * The request object enables you to retrieve socket data, HTTP data, the headers, the parameters, and the payload (for POST). | ||
+ | * Note that parameters are available as Map< | ||
+ | * The response object allows you to set the HTTP response line and headers as well as the payload. | ||
+ | |||
+ | |||
Line 11: | Line 38: | ||
* Read Sections 6.1 through 6.5 of our textbook. | * Read Sections 6.1 through 6.5 of our textbook. | ||
+ | * Take an overall look at the servlet API (accessible from our // | ||
+ | * Come to Prism for a hands-on lecture |
servlets.1191862097.txt.gz · Last modified: 2007/10/08 16:48 by roumani