Скачать презентацию Introduction to the Web Vadim Parizher COMP-496 EBT Скачать презентацию Introduction to the Web Vadim Parizher COMP-496 EBT

032a3a5bbe2f386e6c1f2adaaf541a90.ppt

  • Количество слайдов: 59

Introduction to the Web Vadim Parizher COMP-496 EBT Introduction to the Web Vadim Parizher COMP-496 EBT

Agenda w Internet Technologies w Programming Languages and Paradigms w Programming the Web Agenda w Internet Technologies w Programming Languages and Paradigms w Programming the Web

Internet Technologies The World Wide Web w A way to access and share information Internet Technologies The World Wide Web w A way to access and share information n w w Technical papers, marketing materials, recipes, . . . A huge network of computers: the Internet Graphical, not just textual Information is linked to other information Application development platform n n n Shop from home Provide self-help applications for customers and partners. . .

Internet Technologies WWW Architecture PC/Mac/Unix + Browser Client Request: http: //www. msn. com/default. asp Internet Technologies WWW Architecture PC/Mac/Unix + Browser Client Request: http: //www. msn. com/default. asp Network TCP/IP Response: … Server Web Server

Internet Technologies WWW Architecture w Client/Server, Request/Response architecture n You request a Web page Internet Technologies WWW Architecture w Client/Server, Request/Response architecture n You request a Web page l l n The Web server responds with data in the form of a Web page l l n e. g. http: //www. msn. com/default. asp HTTP request HTTP response Web page is expressed as HTML Pages are identified as a Uniform Resource Locator (URL) l l Protocol: http Web server: www. msn. com Web page: default. asp Can also provide parameters: ? name=Leon

Internet Technologies Web Standards w Internet Engineering Task Force (IETF) n n n http: Internet Technologies Web Standards w Internet Engineering Task Force (IETF) n n n http: //www. ietf. org/ Founded 1986 Request For Comments (RFC) at http: //www. ietf. org/rfc. html w World Wide Web Consortium (W 3 C) n n n http: //www. w 3. org Founded 1994 by Tim Berners-Lee Publishes technical reports and recommendations

Internet Technologies Web Design Principles w Interoperability: Web languages and protocols must be compatible Internet Technologies Web Design Principles w Interoperability: Web languages and protocols must be compatible with one another independent of hardware and software. w Evolution: The Web must be able to accommodate future technologies. Encourages simplicity, modularity and extensibility. w Decentralization: Facilitates scalability and robustness.

Internet Technologies Hypertext Markup Language (HTML) w The markup language used to represent Web Internet Technologies Hypertext Markup Language (HTML) w The markup language used to represent Web pages for viewing by people n Designed to display data, not store/transfer data w Rendered and viewed in a Web browser w Can contain links to images, documents, and other pages w Not extensible w Derived from Standard Generalized Markup Language (SGML) w HTML 3. 2, 4. 01, XHTML 1. 0

Internet Technologies HTML Forms w Enables you to create interactive user interface elements n Internet Technologies HTML Forms w Enables you to create interactive user interface elements n n Buttons Text boxes Drop down lists Check boxes w User fills out the form and submits it w Form data is sent to the Web server via HTTP when the form is submitted

Internet Technologies Hypertext Transport Protocol (HTTP) w The top-level protocol used to request and Internet Technologies Hypertext Transport Protocol (HTTP) w The top-level protocol used to request and return data n w w E. g. HTML pages, GIFs, JPEGs, Microsoft Word documents, Adobe PDF documents, etc. Request/Response protocol Methods: GET, POST, HEAD, … HTTP 1. 0: simple HTTP 1. 1: more complex

Internet Technologies HTTP Request Method File HTTP version Headers GET /default. asp HTTP/1. 0 Internet Technologies HTTP Request Method File HTTP version Headers GET /default. asp HTTP/1. 0 Accept: image/gif, image/x-bitmap, image/jpeg, */* Accept-Language: en User-Agent: Mozilla/1. 22 (compatible; MSIE 2. 0; Windows 95) Connection: Keep-Alive If-Modified-Since: Sunday, 17 -Apr-96 04: 32: 58 GMT Blank line Data – none for GET

Internet Technologies HTTP Response HTTP version Status code Reason phrase Headers HTTP/1. 0 200 Internet Technologies HTTP Response HTTP version Status code Reason phrase Headers HTTP/1. 0 200 OK Date: Sun, 21 Apr 1996 02: 20: 42 GMT Server: Microsoft-Internet-Information-Server/5. 0 Connection: keep-alive Content-Type: text/html Last-Modified: Thu, 18 Apr 1996 17: 39: 05 GMT Content-Length: 2543 Some data. . . blah, blah Data

Internet Technologies HTTP Server Status Code Description 200 OK 201 Created 301 Moved Permanently Internet Technologies HTTP Server Status Code Description 200 OK 201 Created 301 Moved Permanently 302 Moved Temporarily 400 Bad Request – not understood 401 Unauthorized 403 Forbidden – not authorized 404 Not Found 500 Internal Server Error

Internet Technologies HTTP w HTTP is a stateless protocol w Each HTTP request is Internet Technologies HTTP w HTTP is a stateless protocol w Each HTTP request is independent of previous and subsequent requests w HTTP 1. 1 introduced keep-alive for efficiency w Statelessness has a big impact on how scalable applications are designed

Internet Technologies Cookies w A mechanism to store a small amount of information (up Internet Technologies Cookies w A mechanism to store a small amount of information (up to 4 KB) on the client w A cookie is associated with a specific web site w Cookie is sent in HTTP header w Cookie is sent with each HTTP request w Can last for only one session (until browser is closed) or can persist across sessions w Can expire some time in the future

Internet Technologies HTTPS w A secure version of HTTP w Allows client and server Internet Technologies HTTPS w A secure version of HTTP w Allows client and server to exchange data with confidence that the data was neither modified nor intercepted w Uses Secure Sockets Layer (SSL)/ Transport Layer Security (TLS)

Internet Technologies URIs, URLs and URNs w Uniform Resource Identifier (URI = URL or Internet Technologies URIs, URLs and URNs w Uniform Resource Identifier (URI = URL or URN) n Generic term for all textual names/addresses w Uniform Resource Locator (URL) n The set of URI schemes that have explicit instructions on how to access the resource over the Internet, e. g. http, ftp, gopher w Uniform Resource Name (URN) 1) A URI that has an institutional commitment to availability, etc. 2) A particular scheme intended to identify resources e. g. urn: schemas: httpmail: subject

Internet Technologies Multipurpose Internet Mail Extensions (MIME) w Defines types of data/documents n n Internet Technologies Multipurpose Internet Mail Extensions (MIME) w Defines types of data/documents n n n n text/plain text/html image/gif image/jpeg audio/x-pn-realaudio/x-ms-wma video/x-ms-asf application/octet-stream

Internet Technologies MIME w Specifies character sets, e. g. ASCII w Supports multi-part messages Internet Technologies MIME w Specifies character sets, e. g. ASCII w Supports multi-part messages w Originally designed for email, but also used in other places, such as HTTP

Internet Technologies Browsers w Client-side application w Requests HTML from Web server and renders Internet Technologies Browsers w Client-side application w Requests HTML from Web server and renders it w Popular browsers: n n Netscape Internet Explorer Opera others w Also known as a User Agent

Internet Technologies Clients & Servers w Client and Server computers both have: n n Internet Technologies Clients & Servers w Client and Server computers both have: n n n CPU Memory I/O l l n n n Disks Network Bus Multi-tasking operating system Applications

Internet Technologies Clients & Servers w Clients n n n Generally supports a single Internet Technologies Clients & Servers w Clients n n n Generally supports a single user Optimized for responsiveness to user User interface, graphics w Servers n n Supports multiple users Optimized for throughput More: CPUs (SMP), memory, disks (SANs), I/O Provide services (e. g. Web, file, print, database, e-mail, fax, transaction, telnet, directory)

Internet Technologies Proxy Servers & Firewalls w Proxy Server n n n A server Internet Technologies Proxy Servers & Firewalls w Proxy Server n n n A server that sits between a client (running a browser) and the Internet Improves performance by caching commonly used Web pages Can filter requests to prevent users from accessing certain Web sites w Firewall n A server that sits between a network and the Internet to prevent unauthorized access to the network from the Internet

Internet Technologies Networks w Network = an interconnected collection of independent computers w Why Internet Technologies Networks w Network = an interconnected collection of independent computers w Why have networks? n n Resource sharing Reliability Cost savings Communication w Web technologies add: n n n New business models: e-commerce, advertising Entertainment Applications without a client-side install

Internet Technologies Networks w Network scope n n internet: a collection of connected networks Internet Technologies Networks w Network scope n n internet: a collection of connected networks Internet: a specific world-wide network based on TCP/IP, used to connect companies, universities, governments, organizations and individuals. Originated as ARPANET, funded by the US Do. D. intranet: a network based on Internet technologies that is internal to a company or organization extranet: a network based on Internet technologies that connects one company or organization to another

Internet Technologies Networks w Network technology is largely determined by scale: n n Local Internet Technologies Networks w Network technology is largely determined by scale: n n Local Area Network (LAN): Span up to a few kilometers. Bus vs. ring topologies Wide Area Networks (WAN): Can span a country or continent. WANs use routers as intermediate nodes to connect transmission lines

Internet Technologies Networks w Network technology n Broadcasting l l n Point-to-point l n Internet Technologies Networks w Network technology n Broadcasting l l n Point-to-point l n Packets of data are sent from one machine and received by all computers on the network Multicast: packets are received by a subset of the machines on a network Packets have to be routed from one machine to another; there many be many paths In general, geographically localized networks use broadcasting, while disperse networks use point-to-point

Internet Technologies Networks OSI Model Layers Application Layer Presentation Layer Session Layer Transport Layer Internet Technologies Networks OSI Model Layers Application Layer Presentation Layer Session Layer Transport Layer Network Layer Data Link Layer Physical Layer TCP/IP Protocol Architecture Layers Application Layer TCP/IP Protocol Suite Telnet FTP Host-to-Host Transport Layer SMTP DNS RIP TCP Internet Layer Ethernet HTTP UDP ARP Network Interface Layer SNMP IGMP IP Token Ring Frame Relay ICMP ATM

Internet Technologies Network Protocol Stack HTTP TCP IP IP Ethernet Internet Technologies Network Protocol Stack HTTP TCP IP IP Ethernet

Internet Technologies Networks - Internet Layer w Internet Protocol (IP) w Responsible for getting Internet Technologies Networks - Internet Layer w Internet Protocol (IP) w Responsible for getting packets from source to destination across multiple hops w Not reliable w IP address: 32 bit value usually written in dotted decimal notation as four 8 -bit numbers (0 to 255); e. g. 130. 50. 12. 4

Internet Technologies Networks - Transport Layer w Provides efficient, reliable and cost-effective service w Internet Technologies Networks - Transport Layer w Provides efficient, reliable and cost-effective service w Uses the Sockets programming model w Ports identify application n Well-known ports identify standard services (e. g. HTTP uses port 80, SMTP uses port 25) w Transmission Control Protocol (TCP) n Provides reliable, connection-oriented byte stream w UDP n Connectionless, unreliable

Internet Technologies Networks - Application Layer w w w w Telnet: Remote sessions File Internet Technologies Networks - Application Layer w w w w Telnet: Remote sessions File Transfer Protocol (FTP) Network News Transfer Protocol (NNTP) Simple Network Management Protocol (SNMP) Simple Mail Transfer Protocol (SMTP) Post Office Protocol (POP 3) Interactive Mail Access Protocol (IMAP)

Internet Technologies Networks - Domain Name System (DNS) w Provides user-friendly domain names, e. Internet Technologies Networks - Domain Name System (DNS) w Provides user-friendly domain names, e. g. www. msn. com w Hierarchical name space with limited root names n n . com. net. gov. edu n n . org. mil. jp. de w DNS servers map domain names to IP addresses

Internet Technologies Extensible Markup Language (XML) w Represents hierarchical data w A meta-language: a Internet Technologies Extensible Markup Language (XML) w Represents hierarchical data w A meta-language: a language for defining other languages w Extensible w Useful for data exchange and transformation w Simplified version of SGML

Agenda w Internet Technologies w Programming Languages and Paradigms w Programming the Web Agenda w Internet Technologies w Programming Languages and Paradigms w Programming the Web

Programming Languages w Machine code w Assembly language w High-level languages n n Fortran, Programming Languages w Machine code w Assembly language w High-level languages n n Fortran, LISP, Cobol C, Pascal, Basic, Smalltalk C++, Eiffel Java, C# w Scripting languages n Shell scripts, Perl, TCL, Python, Java. Script, VBScript

Programming Paradigms w w w Unstructured programming Structured programming Object-oriented programming Component-based programming Event-based Programming Paradigms w w w Unstructured programming Structured programming Object-oriented programming Component-based programming Event-based programming

Programming Paradigms Unstructured Programming w See “Go To Statement Considered Harmful” at http: //www. Programming Paradigms Unstructured Programming w See “Go To Statement Considered Harmful” at http: //www. acm. org/classics/oct 95/

Programming Paradigms Structured Programming w Sequence w Conditional n n if then else switch Programming Paradigms Structured Programming w Sequence w Conditional n n if then else switch w Looping n n n for i from 1 to n do while do until w Functions w Exceptions

Programming Paradigms Object-Oriented Programming w Objects have data and behavior n n Data: members, Programming Paradigms Object-Oriented Programming w Objects have data and behavior n n Data: members, fields, variables, slots, properties Behavior: methods, functions, procedures w Using objects is easy n n First instantiate the type of object desired Then call its methods and get/set its properties w Designing new types of objects can be hard n Design goals often conflict: simplicity, functionality, reuse, performance

Programming Paradigms Object-Oriented Programming w Key object-oriented concepts n n Identity Encapsulation l l Programming Paradigms Object-Oriented Programming w Key object-oriented concepts n n Identity Encapsulation l l n n n Data + behavior Information hiding (abstraction) Classes vs. instances Polymorphism Interfaces Delegation, aggregation Inheritance Patterns

Programming Paradigms Component-Based Programming w Components n n Independent modules of reuse and deployment Programming Paradigms Component-Based Programming w Components n n Independent modules of reuse and deployment Coarser-grained than objects (objects are language-level constructs) Includes multiple classes Often language-independent w In the general case, the component writer and the component user don’t know each other, don’t work for the same company, and don’t use the same language

Programming Paradigms Component-Based Programming w Component Object Model (COM) n n Initial Microsoft standard Programming Paradigms Component-Based Programming w Component Object Model (COM) n n Initial Microsoft standard for components Specifies a protocol for instantiating and using components in-process, across processes or across machine boundaries Basis for Active. X, OLE, and many other technologies Can be created in Visual Basic, C++, . NET, … w Java Beans n n Java standard for components Not language-independent

Programming Paradigms Event-Based Programming w When something of interest occurs, an event is raised Programming Paradigms Event-Based Programming w When something of interest occurs, an event is raised and application-specific code is executed w Events provide a way for you to hook in your own code into the operation of another system w Event = callback w User interfaces are all about events n on. Click, on. Mouse. Over, on. Mouse. Move… w Events can also be based upon time or interactions with the network, operating system, other applications, etc.

Agenda w w Internet Technologies Programming Languages and Paradigms Programming the Web. NET Overview Agenda w w Internet Technologies Programming Languages and Paradigms Programming the Web. NET Overview

Programming the Web Client-Side Code w What is client-side code? n Software that is Programming the Web Client-Side Code w What is client-side code? n Software that is downloaded from Web server to browser and then executes on the client w Why client-side code? n n n Better scalability: less work done on server Better performance/user experience Create UI constructs not inherent in HTML l l n n Drop-down and pull-out menus Tabbed dialogs Cool effects, e. g. animation Data validation

Programming the Web Client-Side Technologies w DHTML/Java. Script w COM n n n w Programming the Web Client-Side Technologies w DHTML/Java. Script w COM n n n w w Active. X controls COM components Remote Data Services (RDS) Java Plug-ins Helpers Remote Scripting

Programming the Web Dynamic HTML (DHTML) w Script that is embedded within an HTML Programming the Web Dynamic HTML (DHTML) w Script that is embedded within an HTML page w Usually written in Java. Script (ECMAScript, JScript) for portability n Internet Explorer also supports VBScript and other scripting languages w Each HTML element becomes an object that has associated events (e. g. on. Click) w Script provides code to respond to browser events

Programming the Web DHTML w The DHTML Document Object Model (DOM) window event navigator Programming the Web DHTML w The DHTML Document Object Model (DOM) window event navigator history document location screen frames all location children forms selection body links radio button text password file checkbox submit reset textarea select option

Programming the Web Active. X w Based on COM w Native only to Internet Programming the Web Active. X w Based on COM w Native only to Internet Explorer n Supported in Netscape with a plug-in w Good when you know your users (e. g. intranet) or can specify which browser to use w Small, efficient code

Programming the Web Java Applets w Based on Java bytecode w Held great promise Programming the Web Java Applets w Based on Java bytecode w Held great promise as a portable, pain-free way to download client-side code: n “Write once, run anywhere” w Fairly safe: code runs in a “sandbox” w Compatibility and performance issues have prevented common usage

Programming the Web Server-Side Code w What is server-side code? n n Software that Programming the Web Server-Side Code w What is server-side code? n n Software that runs on the server, not the client Receives input from l l n n URL parameters HTML form data Cookies HTTP headers Can access server-side databases, e-mail servers, files, mainframes, etc. Dynamically builds a custom HTML response for a client

Programming the Web Server-Side Code w Why server-side code? n Accessibility l n Manageability Programming the Web Server-Side Code w Why server-side code? n Accessibility l n Manageability l l n Does not require distribution of application code Easy to change code Security l l n You can reach the Internet from any browser, any device, any time, anywhere Source code is not exposed Once user is authenticated, can only allow certain actions Scalability l Web-based 3 -tier architecture can scale out

Programming the Web Server-Side Technologies w w w w Common Gateway Interface (CGI) Internet Programming the Web Server-Side Technologies w w w w Common Gateway Interface (CGI) Internet Server API (ISAPI) Netscape Server API (NSAPI) Active Server Pages (ASP) Java Server Pages (JSP) Personal Home Page (PHP) Cold Fusion (CFM) ASP. NET

Programming the Web Active Server Pages (ASP) w Technology to easily create server-side applications Programming the Web Active Server Pages (ASP) w Technology to easily create server-side applications w ASP pages are written in a scripting language, usually VBScript or JScript w An ASP page contains a sequence of static HTML interspersed with server-side code w ASP script commonly accesses and updates data in a database

Programming the Web ASP HTTP request (form data, HTTP header data) HTTP response HTML, Programming the Web ASP HTTP request (form data, HTTP header data) HTTP response HTML, XML ASP page (static HTML, server-side logic)

Conclusion w Internet Technologies w Programming Languages and Paradigms w Programming the Web Conclusion w Internet Technologies w Programming Languages and Paradigms w Programming the Web

More Resources w HTTP n n http: //msdn. microsoft. com/library/periodic/period 96/protocol. htm HTTP Essentials, More Resources w HTTP n n http: //msdn. microsoft. com/library/periodic/period 96/protocol. htm HTTP Essentials, Stephen Thomas, 2001, Wiley, ISBN 0471 -39823 -3 w Cookies n http: //msdn. microsoft. com/library/default. asp? URL=/library/partb ook/instantj/cookies. htm w MIME n n http: //www. ufaq. org/navcom/mime_tutorial. html http: //www. irvine. com/~mime/ w Networks n http: //msdn. microsoft. com/library/periodic/period 99/ntp 99 b 3. htm

More Resources w XML n n n http: //msdn. microsoft. com/xml/default. asp http: //www. More Resources w XML n n n http: //msdn. microsoft. com/xml/default. asp http: //www. w 3. org/XML/ Essential XML, Don Box, Aaron Skonnard, John Lam, Addison Wesley, 2000, ISBN 0 -201 -70914 -7