2. CREATED BY K. VICTOR BABU
Learning Objectives
Discuss Java editions
Describe distributed applications
Explain Client-Server Model and important terms related to it
3. CREATED BY K. VICTOR BABU
Java Editions
Java EE
Java SE
Java ME
stands for Enterprise Edition
stands for Java’s Standard Edition
stands for Micro Edition
4. CREATED BY K. VICTOR BABU
Java Editions
FEATURES OF JAVA SE (STANDARD EDITION)
• Java SE is the core Java programming platform. It contains all Java libraries.
• The latest version is Java SE 19
• It helps to develop and deploy Java applications on desktops, servers, and embedded
environments. It is used to build standalone applications.
Java SE
5. CREATED BY K. VICTOR BABU
Java Editions
FEATURES OF JAVA EE (ENTERPRISEEDITION)
• Java EE platform is designed to help developers create large-scale, multi-tiered,
scalable, reliable, and secure network applications.
• The latest version is Java EE 8
• It is portable, so it allows an application hosted at one common place to be accessed
by users across the world over the Internet.
• It provides API (Application Programming Interface) to develop distributed
applications that follows Client-Server Model.
• It facilitates the development of web applications.
Java EE
6. CREATED BY K. VICTOR BABU
Java Editions
FEATURES OF JAVA ME (MICRO EDITION)
• Java ME (Java 2 Platform, Micro Edition) is a technology that allows programmers to
develop programs for mobile application devices.
• The latest version is Java ME 8.3
• It consists of programming specifications and a special virtual machine, the K virtual
machine, that allows a Java ME-encoded program to run on mobile devices.
Java ME
7. CREATED BY K. VICTOR BABU
Java EE vs. Java SE
The Java EE (Enterprise Edition) differs from Java SE (Java Standard Edition Platform) in
terms of the libraries it provides to deploy:
• fault-tolerant,
• distributed, and
• multi-tier Java software, based largely on modular components running on an application
server.
8. CREATED BY K. VICTOR BABU
Java EE Libraries and APIs
• Built on top of Java SE, Java EE provides additional libraries for
o database access [JDBC (Java Database Connectivity), J
PA (Java Persistence API)]
o remote method invocation (RMI)
o messaging [JMS (Java Message Service)]
o web services
o XML (eXtensible Markup Language) processing
• It also defines standard APIs for Enterprise JavaBeans, Servlets, Portlets, and Java Server Pages (JSP)
The installation guide containing the steps to download and configure JavaJDK(standard
edition) and Apache Tomcat (to access additional libraries) can be downloaded from your LMS.
9. CREATED BY K. VICTOR BABU
Java EE Architecture
Internet Client
Web
Browser
Intranet Client
GUI
Application
Model
EJ
B Server
EJBContainer
Database
Web Server
Web Container
Controller
<%
%>
View
11. CREATED BY K. VICTOR BABU
• The Java™ 2 Platform, Enterprise Edition (J2EE) provides a standard for developing multitier,
enterprise applications.
• The economy and technology of today have intensified the need for faster, more efficient, and
larger-scale information management solutions.
• The J2EE specification satisfies these challenges by providing a programming model that
improves development productivity, standardizes the platform for hosting enterprise
applications, and ensures portability of developed applications with an extensive test suite.
• J2EE applications are comprised of components, containers, and services. Components are
application-level components. Web components, such as Servlets and JSPs, provide dynamic
responses to requests from a Web page.
• EJB components contain server-side business logic for enterprise applications. Web and EJB
component containers host services that support Web and EJB modules.
Java EE Architecture
12. CREATED BY K. VICTOR BABU
J2EE architecture supports component-based development of multi-tier enterprise applications. A
J2EE application system typically includes the following tiers:
Client tier
• In the client tier, Web components, such as Servlets and JavaServer Pages (JSPs), or standalone
Java applications provide a dynamic interface to the middle tier.
Middle tier
• In the server tier, or middle tier, enterprise beans and Web Services encapsulate reusable,
distributable business logic for the application. These server-tier components are contained on a
J2EE Application Server, which provides the platform for these components to perform actions
and store data.
Enterprise data tier
• In the data tier, the enterprise's data is stored and persisted, typically in a relational database.
Java EE Architecture
13. CREATED BY K. VICTOR BABU
• Java EE platform facilitates an architecture in which the business components are placed in a
separate tier.
• The Java EE architecture enhances features such as scalability, extensibility, and
maintainability.
• Its modular design allows easy modification of the business logic. It provides more security
because it partitions business services from the web tier. It also permits clean job separation
of job roles.
• The enterprise components can leverage their EJB container for service, such as component
and
resource management, security, persistence, and transactions.
Java EE Architecture: Features
14. CREATED BY K. VICTOR BABU
Complexity
Robustness
HTML Pages
HTML Pages
Basic JSPPages
and Servlets
• HTML Pages
• JSPPages
• Servlets
JSPPages with
Modular
Component
• HTML Pages
• JSPPages
• Servlets
• Java Beans
Component
• Custom Tags
JSPPages with
Modular
Component and
Enterprise
JavaBeans
• HTML Pages
• JSPPages
• Servlets
• Java Beans
Component
• Custom Tags
• Enterprise
JavaBeans
Relating Java EE Architecture Complexity and Robustness
15. CREATED BY K. VICTOR BABU
Complexity
Robustness
HTML Pages
Basic JSPPages
HTML Pages • HTML Pages
• Servlets
JSPPages with
Modular
• HTML Pages
• JSPPages
• Servlets
• Java Beans
Component
• Custom Tags
JSPPages with
Modular
Component and
Enterprise
JavaBeans
• HTML Pages
• JSPPages
• Servlets
Component
• Custom Tags
• Enterprise
Java Bean
• As the richness and robustness of a web applicationCionmcrpeaosneesn,tso does the complexity.
• The complexity of the appliacantdioSnercvalnetbsemanaged by proper design that helps in getting
rid of programming concerns.
• The web container and Java EE platform provide components that can be•usJaevdatBoeans
manage complex applica•tioJSnPdPeasgigens.
Relating Java EE Architecture Complexity and Robustness
KEY POINTS
16. CREATED BY K. VICTOR BABU
Advanced Java
Topic 2—Distributed Applications and Client-Server Model
• Distributed Applications
• Client Server Model
• HTTP Protocol
• Types of Server Response
• Client Request Types
• HTML
• Running HTML code with Apache
17. CREATED BY K. VICTOR BABU
Recall!
Java EEprovides API (Application Programming Interface) to develop
distributed applications that follow Client-Server Model.
18. CREATED BY K. VICTOR BABU
Distributed Applications
• In distributed applications, same application can run across different machines at the same time using internet.
• One machine acts as Server where application is deployed and the other machines act as Client.
Application
Server 1
Client 1
Client 2
Client 3
Client 4
Application
Server 2
Client 1
Client 2
Client 3
Client 4
Application
Server 3
Client 1
Client 2
Client 3
Client 4
Application
Server 4
Client 1
Client 2
Client 3
Client 4
INTERNET
19. CREATED BY K. VICTOR BABU
Client-Server Model
The client–server model is a distributed application structure that partitions tasks or workloads between
the providers of a resource or service (web servers) and service requesters (web clients).
Both web client and web server are programs.
DEFINITION
A web client is not a user, but a program. Someone who uses this program to send request
to web server is known as “end user.”
20. CREATED BY K. VICTOR BABU
Makes request in the form of an URL:
http://localhost:8080/applicationname
Accepts requests from the client and gives back a
response which can be either static or dynamic.
Responses are delivered in HTML format.
Client-Server Model
ARCHITECTURE
PORT Network
HTTP Protocol
HTTP (Hypertext Transfer Protocol) is a TCP/IP based communication protocol, which is used to deliver
data over the web.
It provides a standardized way for the client to communicate with the server.
Web Client
Include web browser (Chrome,
Mozilla, etc.), chat applications,
and email software etc.
Web Server
Include web, database,
application, chat, email, etc.
request
response
21. CREATED BY K. VICTOR BABU
Client-Server Model
SIGNIFICANCE OF URL AND PORT
Uniform Resource Locator (URL) uniquely identifies a resource on the internet and follows HTTP protocol.
The machine on which the application is
hosted/deployed
http://localhost:8080/MyApplication
Server port number on which the
server is functional on the machine Name of the application/context root
Tomcat server runs on port 8080. Remember to check during installation.
22. CREATED BY K. VICTOR BABU
Client-Server Model
FEATURES OF HTTP PROTOCOL
• HTTP (Hypertext Transfer Protocol) is a TCP/IP based communication protocol, which is used
to deliver data over the web.
• This protocol is used to change or transfer the hypertext.
• Hypertext is a structure text that uses logical links between containing text.
• It is a stateless protocol—it does not require the HTTP server to retain information about each
user.
23. CREATED BY K. VICTOR BABU
Client-Server Model
SERVER RESPONSE
Server generates response for Client request. It sends three things:
1. Status which tells whether client’s response has successfully reached the server or not.
Example: 404
error for page not found.
2. Information about the type of content that the server is going to send. The server sends
HTML pages as response.
3. Actual content, example: when client types http://www.google.com in any browser,
the server navigates the client to the Google home page.
24. CREATED BY K. VICTOR BABU
Client-Server Model
SERVER RESPONSE TYPES
• Static Page: There is no change in the content. Client requests a web page and server gets the page
back as response.
• Dynamic Page: The page content changes frequently. Server may not be able to process the request.
Dynamic Content
User Login
Page
Home
Page
Map Page
Static Content
styles.css Dojo.js logo.jpg
Web Server
25. CREATED BY K. VICTOR BABU
Client-Server Model
TYPES OF SERVERS
Commonly used server types are as follows:
• Web Server
• Application Server
• Proxy Server
• Virtual ServerBlade Server
• File Server
• Policy Server
We will focus on web and application server in this course.
26. CREATED BY K. VICTOR BABU
Web Server Vs. Application Server
Web Server Application Server
Web Server program runs on the server. It is a component based product.
It looks for incoming requests and services those requests.
Once the web server receives a request, depending on the
type of request, it might look for a web page, or execute a
program on the server.
It provides middleware services for security and state
maintenance, along with data access and persistence.
Web servers have plugins to support scripting languages like
Perl, PHP, ASP, JSP etc. through which they can generate
dynamic HTTP content.
Application Server can do whatever Web Server is capable of
doing as it has Web Server as an integral part. Additionally, it
has components and features to support Application level
services such as Connection Pooling, Object Pooling,
Transaction Support, Messaging services, etc.
It acts as a container which serves static content. It acts as container upon which business logic is built.
Web Server only supports Servlets and JSP. Application Server supports distributed transaction and EJB.
27. CREATED BY K. VICTOR BABU
• GET
• POST
• PUT
• DELETE
• TRACE
• OPTIONS
• HEAD
Client-Server Model
CLIENT REQUEST TYPES
28. CREATED BY K. VICTOR BABU
GET
POST
PUT
DELETE
TRACE
OPTION
HEAD
Client-Server Model
CLIENT REQUEST TYPES: GET
• Used to GET the resource
• It can send limited data
• It is not secure, can be bookmarked and, the data is visible in URL
• It is the default method
29. CREATED BY K. VICTOR BABU
GET
POST
PUT
DELETE
TRACE
OPTION
HEAD
Client-Server Model
CLIENT REQUEST TYPES: POST
• It is used to process data, save data, change data, etc.
• It is secure and cannot be bookmarked
• No limit on data; sent as “payload” and not appended in URL
30. CREATED BY K. VICTOR BABU
GET
POST
PUT
DELETE
TRACE
OPTION
HEAD
Client-Server Model
CLIENT REQUEST TYPES: PUT
• If the Uniform Resource Identifier (URI) refers to an already existing resource, it is
modified. If the URI does not point to an existing resource, then the server can create
the resource with that URI using PUT.
• It replaces all current representation of the target resource with the uploaded content.
31. CREATED BY K. VICTOR BABU
GET
POST
PUT
DELETE
TRACE
OPTION
HEAD
Client-Server Model
CLIENT REQUEST TYPES: DELETE
• DELETE request is used to delete a document of the target resource given by URL.
• To allow eventual consistency while replication, deleted documents remain in the database
forever.
32. CREATED BY K. VICTOR BABU
GET
POST
PUT
DELETE
TRACE
OPTION
HEAD
Client-Server Model
CLIENT REQUEST TYPES: TRACE
• TRACE request is used when the client wants to see if any change has been done by
intermediate server.
• This request works for targeted resources.
33. CREATED BY K. VICTOR BABU
GET
POST
PUT
DELETE
TRACE
OPTION
HEAD
Client-Server Model
CLIENT REQUEST TYPES: OPTION
• OPTION request returns the HTTP method which is supported by the server.
• It allows the client to determine the option requirements associated with a
resource.
34. CREATED BY K. VICTOR BABU
GET
POST
PUT
DELETE
TRACE
OPTION
HEAD
Client-Server Model
CLIENT REQUEST TYPES: HEAD
• HEAD request is used for testing hypertext links for accessibility, validity, and recent
modification.
• This is similar to GET method, but it asks for response without response body.
35. CREATED BY K. VICTOR BABU
Client-Server Model
SERVER RESPONSE: HTML
• HTML stands for Hypertext Mark-up Language.
• It refers to the way the web pages (HTML documents) are linked together. The link
available on a web page is called Hypertext.
• HTML contains tags and elements which are used to format web pages.
36. CREATED BY K. VICTOR BABU
<!DOCTYPE html>
<html>
<head>
<title>Html Program </title>
</head>
<body>
<h1>This is a Heading</h1>
<p>welcome To HTML Program.</p>
</body>
</html>
Client-Server Model
SERVER RESPONSE: HTML DOCUMENT STRUCTURE
A typical HTML document has the following structure:
37. CREATED BY K. VICTOR BABU
Client-Server Model
SERVER RESPONSE: RUNNING AN HTML CODE
1
2
4
Open any editor
Write the HTML code
Save it with HTML extension in any drive of your system
3
To run HTML, double click on “file”
38. CREATED BY K. VICTOR BABU
Running an HTML Code with Apache
TOMCAT APACHE DIRECTORY HIERARCHY
apache-tomcat-8.5.16-windows-x64
bin
lib
webapps
my_project_name
Index.html or
anyname.html
39. CREATED BY K. VICTOR BABU
1. Create a sub-folder in webapps folder
2. Add a name to the project
3. Place your HTML page inside project folder with index.html name or any_other_name.html
4. Open browser to send request through URL
5. Enter this for the URL: http://localhost:8080//my_project_name
6. If html filename is index.html, the above link will open an HTML page. If not, use the following:
http://localhost:8080//my_project_name/any_other_name.html
Running an HTML Code with Apache
41. CREATED BY K. VICTOR BABU
Key Takeaways
Java has three editions: J2SE(standard), J2EE(Enterprise), and J2ME (Micro)
The J2EE(Enterprise Edition) differs from J2SE(JavaStandard Edition Platform) in terms of
the libraries it provides to deploy fault-tolerant, distributed and, multi-tier Javasoftware
In distributed applications, same application can run across different machines at the
same time using internet. One is client and the other is Server.
The client–server model is a distributed application structure that partitions tasks or
workloads between the providers of a resource or service (web servers) and service
requesters (web clients).