2011 revisions L.D. Nel 2005 J. Morrison Sebesta 6th ed authors powerpoint slides
Disk Files c:/assign/data.txt Architecture for code you wrote for Comp 1405/1406
Browser B
COMP 2405 Introduction
Database
3
Lecture Overview
History of the Web Role of Web Applications Network f d N t k fundamentals t l HTTP Protocol Web Applications and tools
- What the Internet is: - A world wide network of dissimilar computers world-wide and computer networks - At the lowest level, since 1982, all connections use TCP/IP - TCP/IP hides the differences among devices connected to the Internet t d t th I t t
Source: Sebesta Programming the World Wide Web 6th ed Addison Wesley Longman inc
The Internet
Networking Basics
Network Layers Structure of the Internet Router t R t C R t to Router Communication i ti IP Addresses
Network Layers
The most common protocols operating on each layer p g y Application Layer Transport Layer Internetwork Layer Network Interface Layer Physical Layer HTTP, FTP, Telnet TCP, UDP IP Ethernet, PPP bits and bytes
10
Router to Router
Magic Magic of router to router communication
11
IP Addresses
Internetworking Protocol (IP) dominates Internetwork Layer Every packet has to and from addresses IP Addresses are 4 byte numbers Assigned by IANA ( g y (Internet Assigned g Numbers Authority) Usually separated by decimals:
134.117.29.41
COMP 2405 Introduction 12
Application to Application
13
Source: Sebesta Programming the World Wide Web 6th ed Addison Wesley Longman inc
16
17
18
- Problem: By the mid-1980s, several different protocols had been invented and were being used on the Internet, all with different user interfaces ( (Telnet, FTP, Usenet, mailto) , , , )
Source: Sebesta Programming the World Wide Web 6th ed Addison Wesley Longman inc
- Web or Internet? - The Web uses one of the protocols h protocols, http, that runs on the Internet--there are several others (telnet, mailto, etc ) etc.)
Source: Sebesta Programming the World Wide Web 6th ed Addison Wesley Longman inc
Source: Sebesta Programming the World Wide Web 6th ed Addison Wesley Longman inc
Browsers
Browsers are in competition and dont all behave the don t same Browsers may or may not comply to standards Browser versions try to evolve towards standards but dont want to break existing sites (conflict)
See following site for browser usage stats: http://www.w3schools.com/browsers/browsers_stats.asp
COMP 2405 Introduction 23
Browsers Browsers
Internet Explorer 8, for example, uses a l compatibility mode to emulate IE 7 for websites that break under the IE8 standards mode Attempt to move forward towards standards but keep old sites from breaking
Moral: Test with many configurations and settings
24
Source: Sebesta Programming the World Wide Web 6th ed Addison Wesley Longman inc
Servers
Apache has about market share Microsoft IIS is runner up with Other servers make up last
28
URL
URL Uniform Resource Locator URI Uniform Resource Identifier Browsers use URLs to locate resources where is the Domain Name & Server
29
URL
Most URLs locate a resource on a path
30
What is a resource?
Anything accessible via the Web Static St ti resources d t change f dont h from request t to request (HTML document or image) Dynamic resources may change based on: y y g changing data source, input, time of day
COMP 2405 Introduction 31
Ports
Every address has ports (aka mailboxes) Certain ports (0-1024) are reserved for standard services
20: File Transfer Protocol (FTP) 22 S 22: Secure Sh ll (SSH) Shell 23: Telnet 25: Simple Mail Transfer Protocol (SMTP) 80: Hypertext Transfer Protocol (HTTP)
COMP 2405 Introduction 32
- Experimental types p yp - Subtype begins with xe.g e g., video/x-msvideo id / id - Experimental types require the server to send a helper application or plug-in so the browser can deal with the file
Source: Sebesta Programming the World Wide Web 6th ed Addison Wesley Longman inc
HTTP
HyperText Transfer Protocol Implements a request-response model used by all web communications Defines format for requests and responses
36
HTTP Requests
- Form: HTTP method d th d domain part of URL HTTP ver. i t f Header fields blank line Message body - An example of the first line of a request:
GET /cs.uccp.edu/degrees.html HTTP/1.1
Source: Sebesta Programming the World Wide Web 6th ed 37 Addison Wesley Longman inc
body y HEAD - Fetch just the header of the document PUT - Store a new document on the server DELETE - Remove a document from the server
Phase
- Form: Status line Response header fields blank line Response body - Status line format: HTTP version status code explanation
HTTP/1.1 - Example: HTTP/1 1 200 OK
Source: Sebesta Programming the World Wide Web 6th ed Addison Wesley Longman inc
HTTP Responses
Header and Body separated by empty line Header must state content-type Example:
HTTP/1.0 200 OK Date: Fri, 27 Aug 2004 10:05:30 GMT Server: Apache/1 2 13 (Linux) Apache/1.2.13 Last-Modified: Thu, 26 Aug 2004 20:14:26 GMT Content-Length: 2523 Content-Type: text/html Content T pe te t/html <html> <head> <title>COMP 2405 Internet Applications</title> ...
COMP 2405 Introduction Source: Sebesta Programming the World Wide Web 6th ed 40 Addison Wesley Longman inc
Response Code
HTTP/1.0 200 OK
41
- Both request headers and response headers must be followed by a blank line
Source: Sebesta Programming the World Wide Web 6th ed Addison Wesley Longman inc
Client Server
COMP 2405 Introduction 43
Client Server
COMP 2405 Introduction 44
Client Server
COMP 2405 Introduction 45
Q. Could the client and server be the same machine? Ans. Yes
Client Server
COMP 2405 Introduction 46
Web Applications
Internet (or web) applications are online applications ( ) pp pp Users access via web browsers Distinct from web sites serving only static content Examples:
Fill out an online registration form (writing your registration information to a database) Make an online purchase ( (validating y g your credit card, logging the transaction) , gg g ) Request a stock chart for a given time range (dynamically generating the image)
47
Web Application
1. 1 2. 3. 3 4. 5. Client makes HTTP request to Server Server notes resource is a PHP program Server runs PHP program S Server gets result Server sends HTTP Response
48
Web Application
49
Source: Sebesta Programming the World Wide Web 6th ed Addison Wesley Longman inc
- Tools for creating XHTML documents - XHTML editors - make document creation easier - Shortcuts to typing tag names, spell-checker, - WYSIWYG XHTML editors - Need not know XHTML to create XHTML documents d t
Source: Sebesta Programming the World Wide Web 6th ed Addison Wesley Longman inc
- JavaScript - A client-side XHTML-embedded scripting language - O l related t J Only l t d to Java th through syntax h t - Dynamically typed and not object-oriented - Provides a way to access elements of XHTML documents and dynamically change them
Source: Sebesta Programming the World Wide Web 6th ed Addison Wesley Longman inc
54
- PHP - A server-side scripting language - Similar to JavaScript - Great for form processing and database access through the Web
Source: Sebesta Programming the World Wide Web 6th ed Addison Wesley Longman inc