Home > Articles > Software Development & Management > UML

Building Web Applications with UML: Web Application Basics

  • Print
  • + Share This
  • 💬 Discuss
This chapter is from the book
Jim Conallen teaches you the basics about Web Applications.
Purchase this book through the end of January and receive four exclusive sample chapters from forthcoming books by some of technology's greatest luminaries. For more information, check http://www.expectsomethingbetter.com.

Web applications evolved from Web sites or Web systems. The first Web sites, created by Tim Berners-Lee while at CERN (the European Laboratory for Particle Physics), formed a distributed hypermedia system that enabled researchers to have access to documents and information published by fellow researchers, directly from their computers. Documents were accessed and viewed with a piece of software called a browser, a software application that runs on a client computer. With a browser, the user can request documents from other computers on the network and render those documents on the user's display. To view a document, the user must start the browser and enter the name of the document and the name of the host computer where it can be found. The browser sends a request for the document to the host computer. The request is handled by a software application called a Web server, an application usually run as a service, or daemon, that monitors network activity on a special port, usually port 80. The browser sends a specially formatted request for a document (Web page) to the Web server through this network port. The Web server receives the request, locates the document on its local file system, and sends it back to the browser; see Figure 2-1.

Figure 2-1FIGURE 2-1 Basic Web system

This Web system is a hypermedia system because the resources in the system are linked to one another. The term Web comes from looking at the system as a set of nodes with interconnecting links. From one viewpoint, it looks like a spider's web. The links provide a means to navigate the resources of the system. Most of the links connect textual documents, but the system can be used to distribute audio, video, and custom data as well. Links make navigation to other documents easy. The user simply clicks a link in the document, and the browser interprets that as a request to load the referenced document or resource in its place.

A Web application builds on and extends a Web system to add business functionality. In its simplest terms, a Web application is a Web system that allows its users to execute business logic with a Web browser. This is not a very precise definition, but most people's conception of a Web application is not, either. There is a subtle distinction between a Web application and a Web site. For the purpose of this book, a Web application is a Web site where user input—navigation through the site and data entry—affects the state of the business: beyond, of course, access logs and hit counters. In essence, a Web application uses a Web site as the front end to a business application.

HTTP

Browsers and Web servers use a special protocol, called the HyperText Transfer Protocol (HTTP), which specifies how a browser should format and send a request to a Web server. The client browser sends a document request consisting of a line of characters terminated by a CR/LF (carriage return/line-feed) pair. A well-behaved server will not require the carriage return character. This request consists of the word GET, a space, and the location of the document relative to the root of the Web server's file system. When a Web server/site is configured, it is usually set up to use a particular directory on the host machine's local file system as the Web site's root directory. Documents are found relative to this directory.

Document Identification

The full identifier for referencing and obtaining the document is called a uniform resource locator (URL). It identifies the protocol (HTTP), host machine name, optional port number, and document name/location. A URL is a single word with no white space. Any further words found on the request line are either ignored or treated according to the full HTTP spec.

A URL is a way to specify an object, or resource, on the network. A URL is like the network equivalent for specifying a file name on a file system. A URL can be used to request many types of objects with different protocols. In addition to HTTP, common Internet protocols include news, FTP, Gopher, and file. Each protocol is specific to the type of information or resource it represents.

When HTTP is specified, the object is a Web page. The following URL requests a Web page from a host identified by http://www.wae-uml.org:

http://www.wae-uml.org/specs/wd/cav43.html

The document name is cav43.html and is located in the directory /specs/wd/. This directory is relative to the Web site's root directory on the Web server.

A more explicit reference to this page could include the port number; however, the default port number, 80, is usually assumed for all HTTP requests:

http://www.wae-uml.org:80/specs/wd/cav43.html

It is possible to configure the Web server to listen to a port other than 80. This is often done to create a "private" Web site. Some Web servers monitor an additional port and use it for Web configuration. This allows Web masters—those responsible for managing a Web server and site—to remotely manage a Web server's configuration with just a browser. This type of configuration tool is an example of a small Web application.

Domain Names

A domain name is simply the textual name used to look up a numeric Internet address. The Internet addressing system in use today is the Internet Protocol (IP).1 When a client requests a URL, the request must be made directly to the host computer. This means that the host name identified in the URL must be resolved into a numeric IP address. This process is done with a domain name server (DNS). A DNS is a network computer that the client has access to and that has a known IP address. Network infrastructure software on the client knows how to request the IP address from a DNS for a given domain name.

The host name http://www.wae-uml.org is made up of two distinct parts. The rightmost dot in the name is used to separate the host name from its top-level domain (TLD), in this case com. The wae-uml part is the subdomain. The term domain name often refers to the combination of the top-level domain and the subdomain. In this case, the domain name is wae-uml.org, and it is this name that I "own." As owner of this domain name, I am responsible for ensuring that an IP address is associated with the domain. Reserving a domain name and not using it to host a Web site or application is referred to as "parking" the domain name, with the expectation that a real host will soon respond meaningfully to this domain name.

When I registered that domain name, I used one of the official registrars delegated the authority to assign domain names. In order to reserve a domain, I had to supply the IP addresses of two name servers (DNS) that would act as the authoritative source for translating the domain name into a valid IP address. It is on this server that I have the rights to adjust, as necessary, the IP address that I want associated with the domain name and all its mutilevel variations. So in my case, I created records in the DNS to equate wae-uml.org, http://www.wae-uml.org, and test.wae-uml.org to the specific IP address of my host computer.

The www and test parts are third-level domains, and their usage is up to the discretion of the host owner. The convention is to use www for HTML Web sites, ftp for FTP servers, nntp for Usenet news servers, and so on, although this shouldn't be confused with the protocol specification part of a URL (see discussion of protocols in this chapter). Third-level domain names serve only as a convenience to host machine administrators and are not part of the domain name ownership process; nor do they impact types of protocols that are used.

Any host can receive the requests for multiple domains. When it makes an HTTP request for a resource to a server, a client application typically includes the full URL that was used to resolve the IP address. The server, with a single IP address, can receive a request and look at the URL to determine which application or separate Web site should handle the request. This is how many Internet service providers (ISPs) can offer basic hosting capabilities to customers with custom domain names on shared machines. I've set up my server to point to a portal application when the request is for wae-uml.org and http://www.wae-uml.org and to a simple test HTML Web site for test.wae-uml.org.

The two types of top-level domains are generic and country specific. An additional one, .arpa, is dedicated to Internet infrastructure. Recently, the list of generic top-level domains was expanded; however, .com, .edu, .net, and .org continue to be the ones most of us recognize. Each domain is intended for a particular type of use. For example, .com domains are for commercial businesses; .net, for Internet service providers; .org, for nonprofit organizations; and .edu, for educational institutions.

Country-specific domains are managed by organizations in individual countries and can define the usage of the second-level domain in any way they want. For example, the .uk top-level domain of the United Kingdom defines a number of second-level domains, such as .co.uk, .me.uk, .org.uk, plc.uk, and ltd.uk, each with its own expected uses. It isn't until the third-level domain is specified that individual organizations can claim ownership.

TLDs are managed by a single authority: Internet Corporation for Assigned Names and Numbers (ICANN, http://www.icann.org), with the distribution of Internet numbers managed by Internet Assigned Numbers Authority (IANA, http://www.iana.org). In the vast majority of situations, you will work through an official registrar—a company responsible for selling domains—or an ISP rather than work directly with these _organizations.

Resource Identifiers

Related to the URL is the uniform resource identifier (URI) and the uniform resource name (URN).2 Simply put, a URI is a superclass to URLs and URNs, whereas the URI is simply an identifier of a resource on the Internet, nothing more. A URL, on the other hand, is a name that includes an access mechanism: name of host server. The URN is required to "remain globally unique and persistent even when the resource ceases to exist or becomes unavailable."3 For all practical purposes, we as Web application developers are interested mostly in URLs since it is these identifiers that we use to connect our Web pages to form a system.

Fault Tolerance

One important design goal of Web systems is that they be robust and fault tolerant. In the first Web systems at CERN, Web documents, computers, and network configurations were often subject to change. This meant that it was possible for Web pages to contain links to documents or host computers that no longer existed. It is even possible for the HTML specification itself to change, by adding elements, or tags. The browsers and Web servers of the system have to deal gracefully with these conditions.

This desire for a high degree of fault tolerance led in part to the decision to use a connectionless protocol, such as HTTP, as the principal protocol for managing document requests. HTTP is considered a connectionless protocol because as soon as the request is made and fulfilled, the connection between the client and server is terminated. The connection is broken by the server when the whole document has been transferred. The client can abort the transfer by breaking the connection before the transfer completes, in which case the server doesn't record any error condition. The server doesn't need to store information about the request after disconnection. This enables hosts and clients to act more independently and is more resistant to temporary network outages.

HTTP runs over TCP (Transmission Control Protocol), but could run over any connection-oriented service. TCP, a lower-level network protocol used by the Internet and many company networks, enables computers to make connections and to exchange information with one another. TCP, usually combined with IP, is an implementation of layers in the OSI (Open Systems Interconnection) model for network communications.

HTTPS—HTTP with Secure Sockets Layer (SSL)—is related to HTTP but uses encryption to help "secure" the communication. HTTPS is used on the Internet for handling sensitive data such as personal and financial information. More detailed discussion of security and encryption is in Chapter 5, Security.

  • + Share This
  • 🔖 Save To Your Account

Discussions

comments powered by Disqus