Web Applications / Web Systems
Juan Pavón Mestras
Dep. Software Engineering and Artificial Intelligence
School of Computing
Universidad Complutense Madrid
Creative Commons
Java EE
Java Platform, Enterprise Edition (Java EE)
Web Applications built based on components:
Application clients and applets (on the client)
Java Servlet, JavaServer Faces (JSF), and JavaServer Pages (JSP) (on
the server)
Enterprise JavaBeans (EJB) (or enterprise beans) (on the server)
Components are deployed and executed in specialized containers
Container examples:
• Applet container in a browser Web
• Tomcat Web Container
• EJB Container
Juan Pavón – UCM 2012-13
J2EE
2
Java EE – Component Containers
Figure from The Java EE 6 Tutorial (2013). Java EE Containers
http://bit.ly/2SiDaU8
Juan Pavón – UCM 2012-13
J2EE
Components vs. objects
A component is characterized by:
Being an independent deployment unit
• Encapsulates its constituent characteristics with respect to its environment
• Third parties can not access the construction details of [19659002] component
• Not partially implanted
Be a composition unit
• With components possibly developed by others
• Must be sufficiently self-contained
• Clear specifications of what is required and of what it provides
• Interacts with its environment through well-defined interfaces
Not having persistent status
• A component is indistinguishable from other copies of it
• Except non-functional attributes such as the serial number
• Therefore, in a process we can say whether or not there is a component,
but not several instances of it
Juan Pavón – UC M 2012-13
J2EE
3
4
Components vs. objects
An object is characterized by:
Being an instantiation unit; they have a unique identity
• They are not partially instantiated
• The identity is unique and does not change during the life of the object
Having a state
• It is created with an initial state that evolves during execution
Encapsulate its state and behavior
• Which is defined either by a class or by a prototype object
Juan Pavón – UCM 2012-13
J2EE
Interfaces
Points Access to components
Allows clients to access services provided by a
component
One component can have multiple interfaces
One for each access point: use, administration, configuration , …
But it is not convenient to have several similar or redundant interfaces
The specification of the interfaces is a contract
The respect of this contract per client and component ensures the success
of the interaction ion
Juan Pavón – UCM 2012-13
J2EE
5
6
Containers
A container is a process where the components are executed
Manages the components of the application
• Lifecycle
Provides access to platform services
• Security, transactions, persistence, connectivity, etc.
The developer has to specify
The components of the application
• Servlets
• JSPs (JavaServer Pages)
• JSFs (JavaServer Faces)
• EJBs (Enterprise Java Beans)
Deployment descriptors (19659002) • Files XML describing the application components
Juan Pavón – UCM 2012-13
J2EE
Architecture of a container
Contract of the component
s
or
v
i
t
to
r
to
l
c
e
d
s
or
i
c
i
v
r
e
S
Components
of application
] Descriptor of
display
Application components
Descriptor of
display
Application components
Descriptor of
display
APIs Services container
O
t
r
or
s
s
e
r
v
i
c
i
or
s
d
e
l
c
or
n
t
e
n
d
o
r
Juan Pavón – UCM 2012-13
J2EE
7
8
Container of applets
class java.applet.Applet
MiApplet
Descriptor of
display
Methods to access other APIs, eg play (url)
Juan Pavón – UCM 2012-13 [19659002] J2EE
9
Java EE – Multi-level architecture (multi-tier)
This model promotes web applications in 4 levels:
machine
client
Level
client
Pages (X) HTML,
applets, JS, CSS
server
Java EE
Level
web
Level
business
JSP or
] servlets
EJBs
server
BD
Level
system of
information
Database
Juan Pavón – UCM 2012-13
J2EE
10
Web Components in Java EE
Java Servlets
Classes written in Java that process HTTP requests and build
responses
JavaServer Pages (JSP)
Documents text-based containing two types of text
• a static data template that can be expressed in a format
as (X) HTML or XML
• elements JSP that determine how the page builds
dynamic content
JavaServer Faces (JSF)
UI components for web applications
Clients in Java EE are
Web Clients : web browsers, web pages, applets
Client applications
Juan Pavón – UCM 2012-13
J2EE
11
Web container
s
or
d
i
r
e
u
q
e
r
d
to
d
i
r
]
g
e
s
e
d
s
e
or
R
l
Java Servlet APIs and JSPs
MiServlet
Descriptor of
deployment
MiJSP
Descriptor of
deployment
Access to remote services
C
i
c
l
or
d
e
v
d
a
p
or
or
i
l
i
n
g
d
e
r
e
c
u
r
s
or
s
Juan Pavón – UCM 2012-13
J2EE
12
Business components in Java EE
Logic that solves the needs of a certain domain
of application
Enterprise beans (EJBs)
They can process data received from the client side and send them to the level of [19659002] information system for storage
Can retrieve information from the information system, process it and
send it to the customer
Types of EJBs
Session bean
• A conversation with a client
Message driven Bean
• Allows a business component to receive messages
asynchronously, usually with the Java Message Service (JMS) [19659002] Juan Pavón – UCM 2012-13
J2EE
13
EJBs container
javax.ejb.EJBHome, javax.ejb.EJBObject
javax.ejb.SessionBean or javax.ejb. EntityBean
d
to
d
i
r
u
g
e
s
s
e
n
or
i
c
c
to
s
n
to
r
T
MiEntityBean
Descriptor of
deployment
MiMessageBean
Descriptor of
deployment
MiSessionBean
Descriptor of
deployment
Access to remote services
i
C
i
c
l
or
d
e
v
d
a
r
e
c
or
r
s
or
s
g
and
s
t
i
or
n
d
e
l
e
s
p
to
c
i
or
d
e
n
o
m
b
r
e
s
J
N
D
I
Juan Pavón – UCM 2012-13
J2EE
14
Java EE Services
Each Java EE container provides services to the
components
Java Naming Direct Interface (JNDI)
Java Persistence API (JPA)
] Java Database Connectivity API (JDBC)
Java Transaction API (JTA)
Java Message Service (JMS)
JavaMail
Java Beans Active Framework (JAF)
Java EE Connector Architecture
Java Authentication and Authorization Service (JAAS)
Java API for XML Processing (JAXP)
SOAP with Attachments API for Java (SAAJ)
Web Services (JAX-WS )
Java API for RESTful Web Service s (JAX-RS)
Juan Pavón – UCM 2012-13
J2EE
15
Assembling and deploying Java EE components
The components are installed in containers from which
can use the services of the platform
The assembly process of the components requires
specify the support of the J2EE server
Security: authorized users
Transaction management model: relationships between methods that
constitute a transaction (treated as a unit)
Java Naming and Directory Interface (JNDI): access to services from
names and directory
Remote connectivity: allows clients to invoke methods in [19659002] the EJBs as if they were in the same virtual machine
Juan Pavón – UCM 2012-13
J2EE
16
Composition of modules in applications
A Java EE application can be delivered as files :
Java Archive (JAR)
Web Archive (WAR) file
Enterprise Archive (EAR)
• Java EE Modules
• Deployment Descriptor (XML document with extension .xml )
.jar
.class files
from EJBs
.war
.class files
from servlets,
other classes
Java, HTML,
images
.rar
Resource adapter
archive: classes and
native code for
connector to EIS
.jar
Java application
Figure 1-6 EAR File Structure, of The Java EE 6 Tutorial (2013).
http://bit.ly/2SiDaU8
Juan Pavón – UCM 2012-13
J2EE
] 17
Life cycle of a Java EE application
Source: Sun Microsystems, Inc., J2EE Connector Architecture Specification
Juan Pavón – UCM 2012-13
J2EE
18
Frameworks Java EE
Apache S truts
Spring
JBoss Seam
GWT (Google Web Toolkit)
Java applications based on Ajax
Stripes, Tapestry, Wicket, Maverick, etc.
See http://bit.ly/2Acnfja
Juan Pavón – UCM 2012-13
J2EE
19
Bibliography
Eric Jendrock et al. The Java EE 6 Tutorial (2013).
http://bit.ly/zyLQ2F
Official documentation
Java EE Specifications
http://bit.ly/1jYQ2rU /javaee/tech/index.html
API specification for version 6 of Java EE
http://bit.ly/1pho3Hx
API specification for GlassFish Server, including Java EE 6 platform
packages and nonplatform packages that are specific to the GlassFish
Server product
http://bit.ly/2AcerKi
J2EE is more efficient than PHP:
http://bit.ly/2SmWekt
Juan Pavón – UCM 2012-13
J2EE [19659002] 20
from Nettech Post http://bit.ly/2AbEIZo
No hay comentarios:
Publicar un comentario