Module: Software Engineering of Web Applications Chapter 2: Technologies 1 Web Applications Evolution steps Extending the presentation capability of HTML through a better separation of content and presentation. The emergence of the eXtensible Markup Language (XML). Server-side scripting extended architectures for Web servers (such as Java2EE or Microsoft .NET) Web services These slides are designed to accompany module: Software Engineering of Web Applications 2 2.1 The HyperText Transfer Protocol (HTTP) The HyperText Transfer Protocol (HTTP) is the very basic ingredient on which the Web is founded. It is a client-server application protocol that defines a standard format for specifying the request of resources on the Web. Through HTTP a user using a client application (e.g., a browser) can request resources available on a remote server (the Web server). Typical resources exchanged through HTTP are HTML pages These slides are designed to accompany module: Software Engineering of Web Applications 3 HTTP More generally, a request may be related to a file of any format stored on the Web server or to the invocation of a program to be executed on the server side. Since such resources are distributed over the Internet, they need an identication mechanism to be located and accessed. The identifier for referencing resources is a string, called the Uniform Resource Locator (URL) These slides are designed to accompany module: Software Engineering of Web Applications 4 URL URL species the protocol used for the resource transfer (e.g., HTTP for Web page exchange, or other protocols, such as FTP, supported by the browser), the name or the IP address of the machine hosting the resource, an optional port number denoting the access to a specific server port, and the document name and location in the Web server's file system. For example, the URL http://home.dei.polimi.it/matera/index.html denotes the file named index.html stored in the directory named matera/ in the file system managed by the Web server installed on the host named home.dei.polimi.it. These slides are designed to accompany module: Software Engineering of Web Applications 5 Additionally, parameters (the so-called query string") can follow to enable, for example, the transfer of processing instructions or simple data provided by users through forms. These slides are designed to accompany module: Software Engineering of Web Applications 6 Request-response cycle of HTTP These slides are designed to accompany module: Software Engineering of Web Applications 7 How does HTTP work? when the user types a URL into the browser address line or when the user clicks on an anchor within a page representing a URL for a given resource, the browser issues an HTTP request, in which a request line species an HTTP method, the URL of the requested resource, and the protocol version. These slides are designed to accompany module: Software Engineering of Web Applications 8 HTTP methods The most important HTTP methods are GET and POST. The GET method submits a plain request for a resource to the Web server, and allows the user to submit simple inputs via the query string. The POST method submits a request that allows the user to submit complex inputs (for example, a long text or a file) to be processed by the server. With the POST method, the user input is packaged as an attachment to the request, and constitutes the so-called request body. These slides are designed to accompany module: Software Engineering of Web Applications 9 When receiving the request, a server locates the resource and sends a response to the client. The response message includes a status line, which includes information about the protocol version and a numeric status code with its associated message (for example, HTTP/1.1 404 Not found), and a message body carrying the actual resource to be exchanged. These slides are designed to accompany module: Software Engineering of Web Applications 10 2.2 The HyperText Markup Language (HTML) Besides managing the request and transfer of resources through the HTTP protocol, a Web browser also handles the visual presentation of the resources. The HyperText Markup Language (HTML) is used to express the content and the visual formatting of Web pages. The document presentation is managed by a processor embedded in the Web browser, which receives as input the marked-up content and transforms it into a rendered document by interpreting the meaning of the tags. These slides are designed to accompany module: Software Engineering of Web Applications 11 A simple HTML page with an embedded image and a clickable hyperlink <HTML> <HEAD> <TITLE>Inserting an image and an anchor </TITLE> <META name="keywords" content="HTML, example"> </HEAD> <BODY> <H1>A simple HTML page</H1> <P>With an embedded image:</P> <P align="left"> <IMG src="http://www.dei.polimi.it/images/logo.gif"> </P> <P align="left">And with a link to an external resource: </P> <P align="left"><FONT face="Arial" size="+1"> <A href="http://www.polimi.it">Click here</A> to open the home page of Politecnico di Milano... </FONT> </P> </BODY> </HTML> These slides are designed to accompany module: Software Engineering of Web Applications 12