User Tools

Site Tools


servlets

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
servlets [2007/10/09 18:11] roumaniservlets [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.
 +
  
  
Line 21: Line 22:
   * It invokes the ''init'' method on it. You may need to instantiate POJO's/beans or initialize in ''init''.   * It invokes the ''init'' method on it. You may need to instantiate POJO's/beans or initialize in ''init''.
   * It creates a pool of threads ready to invoke your servlet's ''service'' method.   * It creates a pool of threads ready to invoke your servlet's ''service'' method.
-  * When a client connects, a thread is (randomly) chosen and assign for this request.+  * 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.   * 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 ''destroy'' method then unloads it.   * When it is time to stop this servlet, the server invokes its ''destroy'' method then unloads it.
  
 == The API == == The API ==
 +  * No need to override ''service'' since it filters based on the request method. Override either ''doGet'' or ''doPost'' (or both)
 +  * 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<String,String[]> and that for payloads you can have a raw stream or a wrapped up one.
 +  * The response object allows you to set the HTTP response line and headers as well as the payload.
 +
 +
 +
  
 ===== To Do ===== ===== To Do =====
  
   * 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 //Resources// Page. 
 +  * Come to Prism for a hands-on lecture
servlets.1191953496.txt.gz · Last modified: 2007/10/09 18:11 by roumani