1_WebArchitecture.ppt

Download Report

Transcript 1_WebArchitecture.ppt

Distributed systems:
an architectural view
Once upon a time…
The
Mainframe
Dumb
Terminal
Dumb
Terminal
Dumb
Terminal
All of the work is done at the center
Fixed local connections
Or modems
Dumb
Terminal
Dumb
Terminal
Dumb
Terminal
Mainframe
logic/data
presentation
User input/output
Mainframe
Terminal
Once upon a time…
The
Mainframe
Intelligent
Terminal
Intelligent
Terminal
Intelligent
Terminal
Intelligent
Terminal
Intelligent
Terminal
Intelligent
Terminal
Some work os done on the periphery: the client-server paradigm
Client server
Most logic/data
Server
Some logic/data +
presentation
Client
Enabled by:
• the Personal Computer / Workstation
• the Internet (TCP/IP)
Client server - evolution
Three tier architecture
The Model
Data
Storage
The Controller
Business
Logic
Presentation
Logic
The View
Client server - problems
Part of the BUSINESS LOGIC is performed on the periphery:
The new version nightmare…
The Web – Back to the old model!
Web Server 1
Web Server 2
Thin client
General purpose
Web Server 3
The Web:
an architectural view
Needed Conceps:
TCP-IP protocol suite
Port
HTTP Overview
HTTP Requests
An HTTP request consists of
a request method, (“subprotocol” specification)
a request URL,
(location)
header fields,
(metadata)
a body.
(data)
HTTP 1.1 defines the following request methods:
• GET: Retrieves the resource identified by the request URL
• HEAD: Returns the headers identified by the request URL
• POST: Sends data of unlimited length to the Web server
• PUT: Stores a resource under the request URL
• DELETE: Removes the resource identified by the request URL
• OPTIONS: Returns the HTTP methods the server supports
• TRACE: Returns the header fields sent with the TRACE request
HTTP 1.0 includes only the GET, HEAD, and POST methods. Although J2EE
servers are required to support only HTTP 1.0, in practice many servers
support HTTP 1.1.
HTTP Overview
HTTP Responses
An HTTP response contains a result code, header fields, and a body.
The HTTP protocol expects the result code and all header fields to be
returned before any body content.
Some commonly used status codes include:
• 100: Continue
• 200: OK
• 404: the requested resource is not available
• 401: the request requires HTTP authentication
• 500: an error occurred inside the HTTP server that prevented it from
fulfilling the request
• 503: the HTTP server is temporarily overloaded and unable to handle
the request
For detailed information on this protocol, see the Internet RFCs: HTTP/1.0
(RFC 1945), HTTP/1.1 (RFC 2616). (http://www.rfc-editor.org/rfc.html)
See also http://en.wikipedia.org/wiki/Http
HTTPS Overview
https is a URI scheme which is syntactically identical to the http:
scheme normally used for accessing resources using HTTP. Using
an https: URL indicates that HTTP is to be used, but with a
different default port (443) and an additional
encryption/authentication layer between HTTP and TCP.
This system was developed by Netscape Communications
Corporation to provide authentication and encrypted
communication and is widely used on the World Wide Web for
security-sensitive communication, such as payment transactions.
S-HTTP Overview
Secure hypertext transfer protocol' (S-HTTP) is an alternative
mechanism to the https URI scheme for encrypting web
communications carried over HTTP. S-HTTP is defined in RFC
2660.
Web browsers typically use HTTP to communicate with web
servers, sending and receiving information without encrypting it.
For sensitive transactions, such as Internet e-commerce or online
access to financial accounts, the browser and server must encrypt
this information.
The https: URI scheme and S-HTTP were both defined in the mid
1990s to address this need. Netscape and Microsoft supported
HTTPS rather than S-HTTP, leading to HTTPS becoming the de
facto standard mechanism for securing web communications. SHTTP is an alternative mechanism that is not widely used.
The primitive Web model
•HTTPD
•Browser
•Get URL
•Get HTML file
File
System
•Send HTML
•Render HTML
The primitive Web model
HTTP Get
File System
Browser
Client
Server
A simple interactive Web model
•HTTPD
•Browser
•CGI Process
•Get URL with Params
•Execute CGI(params)
•Build HTML on the fly
•Send HTML
•Render HTML
A simple interactive Web model
HTTP Get
File System
Browser
Client
Cgi-bin
Server
An evolved interactive Web model
•HTTPD
•Browser
•CGI Process
•Get URL with Params
•Execute CGI(params)
•Send HTML
•Render HTML
•Build HTML on the fly
•Run Sql query
•Send query results
•DB
An evolved interactive Web model
HTTP Get
Browser
Cgi-bin
File System
Query SQL
Data
Client
Server
The Bottlenecks
HTTP Get
File System
Browser
Cgi-bin
Query SQL
Data
Client
Server
The Bottleneck – part I
HTTP Get
File System
Browser
Cgi-bin
Query SQL
Data
Client
Server
The solution:
reduce net traffic by having a
smarter client!
HTTP Get
File System
Smart
browser
Cgi-bin
Query SQL
Data
Client
Server
How?
Including code in HTML
Enabling technologies
Scripting languages
• Javascript
• Vbscript
• Perlscript
• Python
•…
Smart
browser
Programming languages
Client
• Java
The Bottleneck – part II
HTTP Get
File System
Browser
Cgi-bin
Query SQL
Data
Client
Server
The solution:
integrate the service into the httpd
process
HTTP Get
File System
Browser
Query SQL
Data
Client
Server
Enabling technologies
(depending on server implementation)
• Multithreading
• DLL
• Servlets
File System
Using…
•Scripting languages
•Programming languages
Server
How?
Including code in HTML
mixed client- and server-side scripting
<HTML>
Code executed
…
<SCRIPT LANGUAGE=VBScript RUNAT=SERVER> by the Server
…VBScript Commands…
BEFORE the
</SCRIPT>
page is
…
<%VBScript Commands%> ASP Syntax
transferred
…
over the Net
<SCRIPT LANGUAGE=JavaScript>
…JavaScript Commands…
</SCRIPT>
…
Code transferred to the client
</HTML>
and interpreted by the Browser
The state problem
Client
1
Client
3
?
Data User 1
Data User 2
Data User 3
Client
2
Server
A typical solution
Client
1
Cookie
Data User 1
Client
3
Cookie
Data User 2
Data User 3
Client
2
Cookie
Server
A more radical solution
Startup
Client
HTTP Get
Cgi-bin
Browser
Startup
Socket connection
Server
An even more radical solution
Startup
Client
HTTP Get
Cgi-bin
Browser
Startup
Server
Middle
Tier
WAP - Cenni
Client
(cellular phone)
MicroBrowser
9600 baud (*)
Gateway WAP
Request WDP + WTSL
(Wireless Datagram Protocol)
Wireless Transport Security Layer
Page description:
Wml (Wireless Markup Language, in XML) Server HTTP
Hdml (HandhelD Markup Language, variante di HTML
More info: www.wapforum.org
(*) GPRS up to 56 Kbit/sec, UMTS up to 2 Mbit/sec
(Universal Mobile Telecommunication System)
XML Enabled HTTP Server
Client
HTTP
Server
HTTP request
Document
Server
Stylesheet
Server
Get document
XML document
XSLT
Processor
Get SS
XSL stylesheet
XML + XSL
HTML
document
HTML document
The Proxy
Proxy
Browser
Client
Server