Download presentation
Presentation is loading. Please wait.
Published byAldous Tyler Hensley Modified over 9 years ago
1
IS-907 Java EE World Wide Web - Overview
2
World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access Not restricted to particular type of computer(s) Non-centralised Access to existing data Users can add data Annotations Data analysis
3
Web, Internet, internet... internet – connection between local networks Internet – the global tcp/ip based internet (World Wide) Web/W3 – an http-based application that uses the Internet for data transport
4
Web Architecture The World Wide Web uses a client-server architecture Clients (browsers) provides the user interface and displays data Servers provide data to the clients on request Clients and servers are programs The client and server can run on the same computer, or on different computers The computer where the server runs is often called host
5
Building blocks of the web http – the HyperText Transfer Protocol: The rules for communication between clients and servers. URI/URN/URL – Uniform Resource Identifier/ Name/ Locator: The rules for naming data objects on the web. html – HyperText Markup Language: The syntax rules for documents.
6
HyperText Markup Language the document format of the web standardized: http://www.w3.org/standards/techs/html#w3c_all XHTML 1.1 XHTML 1.0 http://www.w3.org/TR/2002/REC-xhtml1-20020801/http://www.w3.org/TR/2002/REC-xhtml1-20020801/ HTML 4.01 http://www.w3.org/TR/html401/http://www.w3.org/TR/html401/ XHTML is defined as an XML application syntax is stricter than plain HTML We will use XHTML 1.0 Even Åby Larsen (even.larsen@uia.no) IS-102 Introduksjon6
7
XHTML pages starts with a document declaration: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> The document contains elements (tags) the top level element is html all tags must have a matching end tag Hello World! the end tag can be abbreviated for empty elements: Even Åby Larsen (even.larsen@uia.no) IS-102 Introduksjon7
8
Simple XHTML page <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <meta http-equiv="Content-Type“ content="text/html; charset=UTF-8" /> Hello Hello World! About... Even Åby Larsen (even.larsen@uia.no) IS-102 Introduksjon8
9
Style sheets Used to define the layout and visual properties of html documents fonts colours margins... Cascading Style Sheets (css) http://www.w3.org/TR/CSS2/ Even Åby Larsen (even.larsen@uia.no) IS-102 Introduksjon9
10
Uniform Resource Locators General format: scheme://host/path Example: http://java.sun.com/j2se/1.5.0/docs/api/http://java.sun.com/j2se/1.5.0/docs/api/ scheme = http host = java.sun.com path = j2se/1.5.0/docs/api Relative URL path from current page to another one. if the page http://mynetshop.com/index.html contains a link to products/computers.htmlhttp://mynetshop.com/index.html it is interpreted by the browser as http://mynetshop.com/products/computers.html http://mynetshop.com/products/computers.html
11
The HyperText Transfer Protocol Request / Response protocol Message format: one or more headers blank line message body ClientServer Request Response
12
HTTP Request Message types GET – used for normal links to get a page, image,... HEAD – just like GET, but no page returned POST – used to send data to the server PUT – create a new object on the web (seldom used) DELETE – remove an object from the web TRACE OPTIONS CONNECT
13
HTTP GET Request Message Example GET / j2se/1.5.0/docs/api HTTP/1.1 Host: java.sun.com
14
HTTP Response Message Example HTTP/1.1 200 OK Date: Tue, 28 Aug 2006 07:33:45 GMT Content-Type: text/html html document....
15
The POST Request The data from a form are transferred in the request body: POST /register HTTP/1.1 Host=my.host.com More=headers paramname=value...
16
Simple web server for static content while (true) { get next request; read contents of file %DOCROOT%/request.path; create a response message; set response headers; set response.body = file contents; send response; }
17
Dynamic web pages Dynamic presentation uses JavaScript and style sheets page remains the same user may interact with presentation Dynamic content server respons with different content depending on input
18
Dynamic content The server doesn’t just map the URL to a filename It must map the URL to a program, run the program, and send the output of the program in the body of the response the program can do anything: get data from a file, or a database do some computation connect to another system...
19
Running a program...? Actually running an external program (CGI) the server sends the request to another program Server ”plugins” (e.g. servlets) the server handles the request by calling the plugin code Scripts inside the html files (ASP, PHP...) the server reads a file (just as for static content), but scans the file for commands, and replaces the commands with the result of executing them
20
web server for dynamic content while (true) { get next request; create a response message; if (cgi-url) { extract program name from request; run the program; set response.body=program output; } else if (plugin-url) { call the plugin; set response.body=plugin output; } else { read contents of file %ROOT%/request.path; if (file contains script) execute script; set response.body = file contents; } send response; }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.