Vocabulary

 < Day Day Up > 



Before we venture too far in to the world of Java servlets, we probably need a small taste of the vocabulary that surrounds these highly flexible inclusions.

Servlet

A servlet is a Java-based server-side small application (or a single Java class) that runs inside of a Web server. It accepts client provided input, responds to the request based on that input, and dynamically generates the output based on those inputs. Servlets are roughly equivalent to a file in the Web server environment.

Servlet Engine

The servlet engine is the part of the application that executes the servlet, forwards the client's request for data to the requested servlet, and then routes the response back to the client application. Apache JServ is the servlet engine that is relevant in this case. The Apache JServ engine is completely written in Java and is a stand-alone server (not necessarily requiring a Web server to allow it to function, although the routing of requests is much simpler through this mechanism).

Servlet Repository

A servlet repository is a collection of servlets, either in a directory or in an archive. Often the archive is a zip file, more often it is a jar file (jar being a Java archive format similar to zip but available only to Java). The Web equivalent is roughly a directory.

Servlet Zone

A servlet zone is the location where the servlets live during their life cycle. It defines the security environment to where the servlet is restricted and allows for the logical separation between different groups of servlets. Also a collection of repositories that share a common context. It is the JServ version of the Web server's virtual host concept.

Servlet Life Cycle

Every servlet must go through a certain execution path. This path starts at the point where the servlet is called and ends when the information is returned to the calling client. It is composed of an initialization phase, execution phase, and destruction phase.

Initialization Phase

In the initialization phase, the servlet engine loads the servlet's .class file into the JVM's memory space, converts the loaded file into a valid object, and initializes it. This step allocates the resources that will be required by the servlet for execution. The Java programming method associated with this part of the life cycle is the init() method.

Execution Phase

Once the servlet is instantiated into JVM memory, it is combined with all of the passed parameters from the calling client to form a request object. The request object is processed and the information to be returned to the calling client is assembled into a response object within this phase. This phase's method would be the service (ServletRequest, Servlet-Response) method.

Destruction Phase

Once the servlet has run and provided suitable output to the client, it cleans up after itself. In the destruction phase, resources that were allocated are returned to the system and the engine shuts down gracefully. The method associated with this portion of the life cycle would be the destroy () method.

Configuration and inclusion of JServ in your environment is accomplished by configuring the Jserv.conf file and the Jserv.properties file along with their includes in the Apache include file tree. Figure 5.1 shows an example of the files called by httpd.conf in an Oracle E-Business Suite configuration.

click to expand
Figure 5.1: Example of Files Called by httpd.conf



 < Day Day Up > 



Oracle 11i E-Business Suite from the front lines
Oracle 11i E-Business Suite from the Front Lines
ISBN: 0849318610
EAN: 2147483647
Year: 2004
Pages: 122

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net