Understanding J2EE Application Containers and Their Roles in Java Enterprise Applications, Slides of Java Programming

An overview of j2ee application containers, their roles, and functions in providing runtime environments for j2ee application components. Containers manage components' lifecycles, provide services like security and connection pooling, and enable components to access other services. Types of containers include application client, applet, web, and ejb containers.

Typology: Slides

2011/2012

Uploaded on 07/13/2012

ahmad.ali
ahmad.ali ๐Ÿ‡ฎ๐Ÿ‡ณ

3.7

(3)

78 documents

1 / 35

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23

Partial preview of the text

Download Understanding J2EE Application Containers and Their Roles in Java Enterprise Applications and more Slides Java Programming in PDF only on Docsity!

๏‚—^ The^ application

server

maintains

control

and^ provides

services

through

an^ interface

or^ framework

known

as^ a

container ๏‚— J2EE^ application

components

use^ the

protocols and

methods of

the^ container

to^ access

other^

application

components

and^ services

provided

by^ the

server.

๏‚—^ Contract

specifies

how^ components

should^ be

developed

and^ deployed. ๏‚— How^ components

can^ access

services^

provided

by

container. ๏‚— Interfaces

and^ Classes,

developer

writes^ the

classes^ that

implements

this^ interfaces. ๏‚—^ Extends

the^ classes

and^ provides

appropriate

implementation

of^ various

methods

and^ rest^

will^ be

done^ by^ container. ๏‚— Container

takes^ the

responsibility

of^ instantiating,

initializing

and^ invoking

the^ components.

Application

does^ not^

directly^ instantiate

or^ invokes

components.

๏‚—^ Server

itself^ Provide

runtime

support

for

J2EE^ application

components ๏‚—^ Application

client container

๏‚—^ Applet

container ๏‚—^ Web^ container ๏‚—^ EJB^ container

๏‚—^ An applet container, meaning a-browser,-usually with the Java Plug-in

๏‚—^ Servlet

container ๏‚—^ Servlet

engine ๏‚—^ A^ J2EE

container

that^ hosts

web^ applications

.

๏‚—^ Extends

the^ web

server^ functionality

by^ providing

developers

the^ environment

to^ run^ servlets

and

JavaServer

Pages^ (JSPs). ๏‚—^ Automatically

instantiates

and^ initializes

the

Servlets

on^ application

startup^

or^ when

invoked

for

the^ first

time.^ Container

calls^ the

service()

method

when^ user

requests

the^ servlet.

๏‚—^ The^ EJB

server

provides

an^ environment

that^ โ€ Supports

the^ execution

of^ applications

developed

using^

Enterprise

JavaBeansโ„ข

(EJB)^ components. ๏‚— Enterprise

beans

typically

contain

the

business

logic^ for

a^ J2EE

application.

๏‚—^ The^ EJB

server^ must

provide^

one^ or^ more

EJB

containers. ๏‚— An^ EJB^ container

manages

the^ enterprise

beans

contained

within^ it. ๏‚—^ Responsible

for โ€ Registering

the^ object โ€ Providing

a^ remote

interface

for^ the^ object

โ€ Creating

and^ destroying

object^ instances โ€ Checking

security

for^ the^ object โ€ Managing

the^ active

state^ for

the^ object

โ€ Coordinating

distributed

transactions.

๏‚—^ Manage

memory

consumption

๏‚—^ Processing ๏‚—^ Containers

pool^ resources ๏‚—^ Lifecycles

of^ all^ the

beans

When^ a

bean^ is

not^ being

used,^ a

container

will^ place

it^ in^ a^ pool

to^ be^ reused

by

another

client,

or^ possibly

evict^ it

from

memory

and^ only

bring^ it

back^ when

its

needed.

A^ container

may^ provide

the^ following

services: ๏‚— Lifecycle

management ๏‚—^ Bean^

Pooling ๏‚—^ Transactions ๏‚—^ Security ๏‚—^ Connection

pooling ๏‚—^ Instance

pooling

๏‚—^ A^ Web

Server is

a^ server

capable

of

โ€ Receiving HTTP requests โ€ Interpreting

them โ€ Processing the

corresponding

HTTP

Responses โ€ Sending them

to^ the

appropriate

clients

(Web^ Browsers). Example:

Apache

Web^ Server.

๏‚—^ It's^ a^

server^

used^ to

communicate

with

Web^ Browsers

as^ its^ clients. ๏‚—^ Communication

protocol used

in^ this

case^ is

HTTP

(HyperText

Transfer

Protocol). ๏‚— This^ is

why^ a^

Web^ Server

is^ also

called

an

HTTP^

Server.

๏‚—^ A^ Web^

Container

is^ a^ J2EE^

compliant

implementation

which^ provides

an^ environment

for^ the^ Servlets and

JSPs^ to

run.^ Putting

it^ differently

we^ can^ say

that^ a^ Web

Container

is^ combination

of^ a^ Servlet Engine

and^ a^ JSP

Engine.^ If

an

HTTP^ Request

refers^ to^ a^ Web^ Component

(typically

a

Servlet or

a^ JSP)^ then

the^ request

is^ forwarded

to^ the^ Web

Container

and^ the^ result

of^ the^ request

is^ sent^ back

to^ Web

Server,^ which

uses^ that

result^ to^

prepare^ the

HTTP

Response

for^ the^ particular

HTTP^ Request.

Example:

Tomcat^ is

a^ typical^

Web^ Container.

A^ typical

setup^ would

be^ to^ have

Apache^ HTTP

Server^ as

the^ Web^

Server^ and

Tomcat^ as

the^ Web^

Container.

20

A^ Web^ Server

that^ Support

Servlets^

and^ Java^ Server

Pages

(JSP)