Learn Java for Web Development

(Tina Meador) #1

44 CHAPTER 2: Building Web Applications Using Servlets and JSP


Note A URL is a concrete form of Uniform Resource Identifier (URI), which is a mechanism to distinguish
entities. But URIs in themselves are abstract. There are two concrete forms of URI: URL and Uniform Resource
Name (URN). URN is still experimental and not widely adopted.

Figure 2-1. Anatomy of a URL


A generic URL is a hierarchical sequence of components, structured as
scheme://hostName:portNumber/path/resource?query string.


To identify the parts of a URL, consider a URL that lists the details of a book on your bookstore web
site, as shown here:


http://www.yourbookstore.com/bookstore/bookServlet?action=bookDetails


Figure 2-1 illustrates the parts of this URL.


The host name and port number together are termed an authority. By default, a web server such as
Tomcat, as explained later, listens for incoming requests on port 8080. Some parts of the URL shown
in Figure 2-1 are optional, including the port number (which defaults to the well-known ports 80 and
443 for the HTTP and HTTPS schemes, respectively) and the query string.


Note HTTPS is HTTP over Secure Sockets Layer (SSL); it allows secure, encrypted communications.

When present, a query string is a series of name-value pairs preceded with a question mark (?) and
with an ampersand (&) separating the pairs.

Free download pdf