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 [2008/10/08 11:42] roumaniservlets [2008/10/08 19:36] (current) roumani
Line 9: Line 9:
 ===== Outline ===== ===== Outline =====
  
-== The Architecture ==+== Tomcat as a Framework == 
 +  * Infrastructural services (networking, logging, data access, etc.) 
 +  * Persistence and session management 
 +  * Events (context and session listeners) 
 +  * Filters 
 +  * Declarative security 
 + 
 +== Architecture ==
   * Tomcat = Coyote + Catalina + Jasper. It is a reference implementation of Sun's Servlet/JSP standards.   * 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+  * All three are 100% Java and live off the same VM. They are one process in the eyes of the O/S. 
-  * Client uses HTTP to reach a Web Server which has a module (Apache) or a plug-in (IIS) for JK filtering. +  * Coyote is a web server / connector, Catalina is a servlet container (aka engine), and Jasper is a JSP processor
-  * 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+  * Client uses HTTP to reach Coyote over TCP/IP; Coyote consults its URL mappings to determine how to serve: traditionally (NFS for static, CGI, or PHP/SSI) or via delegating to Catalina
-  * You supply your servlet subclass to Catalina and it handles the request. +  * Catalina works on the request guided by your servlet
-  * Coyote today comes with an HTTP version that bypasses the JK protocol; i.e. it acts as a web server with NFSCGI, and SSIHence, the whole system is self-contained and 100% Java+  * Jasper turns JSP documents into servletsThink of it as a JSP compiler. 
-  * To enable MVC, servlets are used as controllers, POJO's and Beans for the business model, and JSP for the view.+  * Coyote can also operate as a connector to an existing web server, such as Apache or IISIn that case, the web server would handle traditional serving and, for servlet requests, would use the JK protocol (similar to HTTP but binary) to delegate to Catalina in process. 
 + 
 +== The MVC Design Pattern == 
 +  * Separation of concerns 
 +  * Controller = servlet 
 +  * Model = POJO 
 +  * View = JSP
  
 == The Life Cycle == == The Life Cycle ==
Line 25: Line 38:
   * 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 Directory Structure ==
 +  * The subdirectories bin and conf
 +  * The lib subdirectory
 +  * The subdirectories logs and work
 +  * The projects root: webapps
 +  * The role of WEB-INF vis-a-vis visibility
 +  * The subdirectories of WEB-INF: classes and lib
 +  * The web.xml file
 +  * Deploying war files
 +  * The manager application
  
 == The API == == The API ==
Line 31: Line 55:
   * Note that parameters are available as Map<String,String[]> and that for payloads you can have a raw stream or a wrapped up one.   * 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.   * 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.   * Take an overall look at the servlet API (accessible from our //Resources// Page.
-  * Review Lab-3+  * Complete and then review Lab-3
servlets.1223466131.txt.gz · Last modified: 2008/10/08 11:42 by roumani

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki