Understanding Containers

When you previously installed J2EE, you also installed Sun Microsystems' reference implementation of J2EE, which is a J2EE Product. All J2EE products must provide containers to house J2EE components. The role of the container is to provide a component with the resources it needs to operate and a runtime within which to execute; yet still provide a degree of protection (security) to the application host.

Containers provide a number of services for a component. These services include lifecycle management, threading, security, deployment, and communication with other components. In addition to these services, a container must provide components with Java compatible runtime that conforms to J2SE 1.3.

Different components perform different tasks, so it may come as no surprise that they require different containers. A Product Provider can supply any of the following containers:

  • Applet container

  • Application client container

  • JSP container

  • Servlet container

  • Web container

  • EJB container

It was mentioned previously that all containers must supply a J2SE 1.3-compatible runtime environment. Interestingly, many applet hosts (typically Web browsers) do not support such a high runtime version. To compensate for this, the J2EE specification states that an applet container can use a Java plug-in to provide an appropriate environment.

All of these containers must provide the components they house with certain services and communications protocols. You will learn more about these service and protocols later in this chapter in the “Understanding the Service Supply to their Components” section. These containers must all also provide access to certain J2EE APIs; Table 2.2 shows these APIs.

Table 2.2. J2EE Required Standard Extension APIs
API Applet Application Client Web EJB
JDBC 2.0 Extension N Y Y Y
JTA 1.0 N N Y Y
JNDI 1.2 N Y Y Y
Servlet 2.2 N N Y N
JSP 1.1 N N Y N
EJB 1.1 N Y Y Y
RMI-IIOP 1.0 N Y Y Y
JMS 1.0 N Y Y Y
JavaMail 1.1 N N Y Y
JAF 1.0 N N Y Y

For the sake of simplicity, Table 2.2 does not distinguish between servlet, JSP, and Web containers. You can consider these three containers as a stack where each builds on the functionality of the other. At the bottom of the stack is the servlet container, which must support HTTP; optionally, it might support other protocols. Above this is the JSP container, which provides the same functions as the servlet container and an engine to build servlets from JSP pages. Finally, the Web container provides all the services of the JSP container and access to J2EE service and communications APIs, which today's lesson details next.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.50.222