Web Programming 01

Download as pdf or txt
Download as pdf or txt
You are on page 1of 50

Web Programming

CS333-CS644

Dr Safa’a Saleh

1
Lecture 1

Application Layer
Outline

 Application Architectures
 Host-Based, Client-Based, and Client-Server Architectures,
Choosing Architectures
 World Wide Web
 How the Web Works, Inside an HTTP Request & HTTP
Response
4
Application Layer - Introduction

Applications Application Layer


(e.g., email, web,
word processing)
Transport Layer
Network Layer
• Functions of Applications
– Data storage
– Storing of data generated by programs (e.g., files, records)
– Data access logic
– Processing required to access stored data (e.g., SQL)
– Application logic
– Business logic
– Presentation logic
5
– Presentation of info to user and acceptance of user commands
5 5
Application Architectures

 Determined by how functions of


application programs are spread among
clients and servers
 Host-based Architectures
 Server performs almost all functions
 Client-based architectures
 Client performs most functions
 Client-server architectures
 Functions shared between client and server

6
6
Host-Based Architectures

or a PC running a
terminal emulation
program

– captures key strokes then


sends them to the mainframe
– displays information
according to the server’s
instructions

7
7
Problems with Host-based Arch.

 Host becoming a bottleneck


 Allprocessing done by the host, which can
severely limit network performance
 Upgrades typically expensive & “lumpy”
 Available upgrades require big jumps in
processing and memory  $$$
 Network demand grows more incrementally, so
this often means a poor fit (too much or too little)
between host performance and network demand.

8
8
Client-Based Architectures

Example: Using a word


processing on a PC and
storing data (file) on a server

Was popular in 1980s with the widespread


use of PCs, LANs, and programs such as
spreadsheets and word processors
9
9
Problems with Client-Based Arch.

 Data MUST travel back and forth between


server and client
 Example: when the client program is making
a database query, the ENTIRE database must
travel to the client before the query can be
processed
 Result in poor network performance

10
10
Client-Server Architectures
Used by most networks today
Client Server
(PC) (PC, mini, mainframe)

Example: Using a Web


browser to get pages from

Presentation logic Data Access logic


Application logic Data Storage
Application logic

may reside on the client, server


11
11 or be split up between the two
Client-Server Architectures

 Advantages
 More efficient because of distributed processing
 Allow hardware and software from different
vendors to be used together
 Disadvantages
 Difficulty
in getting software from different
vendors to work together smoothly
 May require Middleware, a third category of
software
12
12
Middleware
client application programs

a standard
– Manages
way of
translating message
Middleware transfers
between
software – Isolates network
from changes from the
different clients ((e.g.,
vendors server application adding a new
programs server)

 Examples:
 Distributed Computing Environment (DCE)
 Common Object Request Broker Architecture (CORBA)
 Open Database Connectivity (ODBC)
13
13
Multi-tier Architectures
 Involve more than two computers in distributing
application program logic
 2-tier architecture (architectures discussed so far)
 3-tier architecture
 3 sets of computers involved
 N-tier architecture
 more than three sets of computers used

14
14
3-tier Architecture

15
15
N-tier Architecture

16
16
Multi-tier Architectures
 Advantages
 Better load balancing:
 More evenly distributed processing. (e.g., application logic
distributed between several servers.)
 More scalable:
 Only servers experiencing high demand need be upgraded

 Disadvantages
 Heavily loaded network:
 More distributed processing  more exchanges

 Difficult to program and test due to increased complexity

17
17
Fat vs. Thin Clients
 Depends on how much of the application logic resides
on the client
 Fat client: (a.k.a., thick client)
 All or most of the application logic

 Thin client:
 Little or no application logic

 Becoming popular because easier to manage, (only the


server application logic generally needs to be updated)
 The best example: World Wide Web architecture (uses a
two-tier, thin client architecture)

18
18
Thin-Client Example: Web Architecture
Web Server
Client (PC, mini,
(PC) mainframe)

Presentation logic Application Logic


Data Access logic
Data Storage

19
19
Criteria for Choosing Architecture
 Infrastructure Cost
 Cost of servers, clients, and circuits
 Mainframes: very expensive; terminals, PCs: very inexpensive
 Development Cost
 Mainly cost of software development
 Software: expensive to develop; off-the-shelf software:
inexpensive
 Scalability
 Ability to increase (or decrease) in computing capacity as
network demand changes
 Mainframes: not scalable; PCs: highly scalable

20
20
Choosing an Architecture

Host-Based Client-Based Client-Server

Cost of
Infrastructure High Medium Low

Cost of
Development Low Medium High

Scalability Low Medium High

21
21
Applications

 World Wide Web


 E-mail
 File Transfer
 Videoconferencing
 Instant Messaging

22
22
World Wide Web
 Two central ideas:
 Hypertext
 A document containing links to other documents

 Uniform Resource Locators (URLs)


 A formal way of identifying links to other documents

 Invention of WWW (1989)


 By Tim Berners-Lee in Switzerland
 First graphical browser, Mosaic, (1993)
 By Marc Andressen at NCSA in USA; later founded Netscape

CERN - Centre Européan pour Rechèrche Nucleaire


NCSA - National Center for Supercomputing Applications
23
23
Web Standard

 World Wide Web(WWW) is a part of the Internet that


consists of Internet connected computers called Web
Servers that store electronic documents called Web
Pages.
 Web Page is a specially formatted document that can
contain images, text, interactive elements, and
hyperlinks, which links to other pages.
 Web Site is a group of related Web Pages.
 A web site’s primary page known as Home Page,
typically introduces the web site and provide
information about the site’s purpose and content.
24
24
Web Standard
 The speed at which data travel from one device to
another is called the transfer rate, which is
expressed as bits per second (bps) – that is, the
number of bits the line can transmit in one second.
 To view Web pages, you need a Web Browser. a
software program that requests, downloads, and
displays Web pages stored on Web Server.

25
25
What is Web Browser ?
 A Web browser is a software that enables a
user to display and interact with the Web’s rich
multimedia content such as text, images, and
other information.
 The Web could be the World Wide Web, a local
area network, or a web page on your own
machine.
 Microsoft Internet Explorer or Netscape
Navigator
 The appearance of a Web page may differ
between browsers.
26
26
URL & Hyperlinks
 Hyperlinks
Graphical or textual elements
 Click
to link to another Web page
 Loads new page into browser window

27
27
URL & Hyperlinks
 URL (Uniform/Universal Resource
Locator)
Web page address – typing in Address
field
 HTTP (HyperText Transfer Protocol)
Protocol for transferring data over the
Internet
 HTTPS (Secure HyperText Transfer
Protocol)
Protocol for transferring encrypted data
over the Internet.
28
URL & Hyperlinks

 A URL identifies a computer on the


Internet

protocol domain name folder

http://www.ipoh.com/news

29
29
URL & Hyperlinks
 You can access a Web page by entering its unique
address, called the Uniform Resource Locator (URL), in
a browser’s address bar.

 URL consist of a domain name and top-level domain


designation.
 Many URLs also included, folder and files names are
separated by forward slash characters following the top-
30
level domain designation.
30
Web Standard.

 An IP address is the numeric address for


computer connected to the Internet.
 Every device in a computer network has an IP
address.
 A domain name is the text version of a
computer’s numeric IP address.

31
31
Web Standard.
 Different between IP Address and Domain Names
IP ADDRESS DOMAIN NAMES
• An identifier for a computer or • A name that identifies one or
device on a TCP/IP network. more IP addresses.
Networks route messages • For example, the domain name
based on the IP address of the notifycorp.com represents
destination. The format of an several IP addresses.
IP address is four numbers • Domain names are used in
separated by periods. Each URLs to identify particular Web
number can be zero to 255. pages.
• For example, 1.140.10.230 • For example, in the URL
could be an IP address. http://www.notifycorp.com/index
.htm, the domain name is
notifycorp.com.
32
32
Types of Web Sites – Cont.

 Top-level domain (TLD)


 A top-level domain (TLD) designation
indicates the type of organization or
general domain.
Top-Level Domain Domain Type
.biz Business
.com Commercial, personal
.edu Education
.gov Government
.mil Military
.net Network providers
33 .org Non-commercial community
33
Types of Web Sites – Cont.

 Some countries have their own TLDs.


.my Malaysia
.sg Singapore
.jp Japan
.us United State
.de German
.fr France
.au Australia

34
34
Types of Web Sites – Cont.
 In URL, the domain name and top-level domain
designation are preceded by a protocol.
 For Web pages, that protocol is the Hypertext
Transfer Protocol (HTTP), which is the
communications standard for transmitting Web
pages over the Internet.
 Most Web browsers will insert the HTTP protocol
automatically as the requested Web page is
downloaded into the browser.

35
35
How the Web Works
Main Web communications protocol:
HTTP - Hypertext Transfer Protocol

A request-response cycle:
include multiple steps since web
Clicking on a hyperlink or pages often contain embedded
typing a URL into a browser files, such as graphics, each
starts a request-response cycle requiring a separate response.
36
How the Web Works
Main Web communications protocol:
HTTP - Hypertext Transfer Protocol

37
Web Standard.
 Different between IP Address and Domain Names

38
38
Web Standard.

39
39
HTTP Request Message
Request line
(command, URL, HTTP version number) required
(If the user
types in the Request header
optional
URL by (information on the browser,
themselves, date, and the referring page )
then the
referring page
is blank.)
Request body
(information sent to the server, optional
e.g., from a form)

40
Example of an HTTP Request
Command URL HTTP version

Request
GET http://www.kelley.indiana.edu/ardennis/home.htm HTTP/1.1
Line
Date: Mon 06 Aug 2001 17:35:46 GMT
Request
User-Agent: Mozilla/6.0 Header
Referer: http://www.indiana.edu/~aisdept/faculty.htm

URL that contained Web browser


the link to the (code name for
requested URL Netscape)

Note that this HTTP Request message has no “Body” part.

GMT – Greenwich Mean Time

41
HTTP Response Message
Response status
(http version number, status code, reason) optional

Response header
optional
(information on the server, date,
URL of the page retrieved, format used )

Response body
(requested web page) required

42
Example of an HTTP Response
HTTP/1.1 200 OK Response
Status
Date: Mon 06 Aug 2001 17:35:46 GMT
Server: NCSA/1.3 Response
Location: http:// www.kelley.indiana.edu/adennis/home.htm Header
Content-type: text/html

<html>
<head>
<title>Allen R. Dennis</title>
</head>
<body>
<H2> Allen R. Dennis </H2> Response
<P>Welcome to the home page of Allen R. Dennis</P> Body

</body>
</html>

Another example of response status: HTTP/1.1 404 page not found)


43
Web Programming

44
44
Multitier Application Architecture

45
HTML - Hypertext Markup Language
 A protocol used to format Web pages
 TAGs embedded in HTML documents
 include information on how to format the file
 Extensions to HTML needed to format
multimedia files
 XML - Extensible Markup Language
A new markup language becoming popular

46
46
Scripting Languages

 Scripting languages, which can be


embedded within HTML, commonly are
used to add functionality to a Web page.
 Scripting languages came about largely
because of the development of the
Internet as a communications tool.
JavaScript, ASP, JSP, PHP, Perl and
Python are examples of scripting
languages.
47
Online Resources

 http://www.w3.org/
 The World Wide Web Consortium (W3C).
 http://www.w3schools.com/
 Full Web Building Tutorials - All Free
 http://wps.prenhall.com/esm_deitel_iw3htp
_3
 The official web page for the text book.

48
Reference

 Reproduced from the PowerPoints for


Internet & World Wide Web How to
Program, 3e by Deitel, Deitel and
Goldberg © 2004.
 Reproduced by permission of Pearson
Education, Inc.

49
ANY QUESTION?

You might also like