Java Reference
In-Depth Information
First, the client starts a request of the Web server by opening a TCP/IP con-
nection to the Web server.
The address of the connection is expressed as a URL. The URL is the standard
addressing system used to locate resources on the Internet. The syntax for a URL is
[protocol]:[resource]. The protocol is the access scheme or method. Common pro-
tocols are http, ftp, gopher, and WAIS.
The part after the colon is interpreted according to the access scheme. In general,
two slashes after the colon introduce a hostname or hostname:port. The hostname
can be an IP address, such as 90.121.111.5, or a name, such as www.yahoo.com. If it
is a name, the name must be translated to a real IP address. A domain name system
(DNS) accomplishes this task. The port number is the socket through which the
server is listening for connections. In most cases, the port number can be omitted
because each protocol has its default port. The browser will attempt to establish the
connection on the default port if the port number is absent in the URL. As long as
the server is listening on the default port, the connection will be made. The standard
port for the HTTP is port 80.
For HTTP, the next part is a pathname. In this simple example, this maps to the
pathname of a file on the server. The file can contain any type of data. Browsers
know what to do with HTML and GIF and JPEG images. Browsers may pass the file
to an external viewer if the appropriate plug-in for the file type has been installed.
This is what happens, for example, when you view a PDF file in the Acrobat viewer.
Once you have it installed, it is invoked to display the contents of the file. A pound
sign (#) following the pathname indicates a particular position on the HTML page.
The URL, after the pathname, may also have a query string preceded by a ques-
tion mark (?). A query string is used when you are running a program on the Web
server, instead of serving a page. So let's stay with the simple example for a moment.
You type the following into your browser's address window: http://
90.121.111.5/resume.html . The browser tries to open the connection to the Web
server running on port 80 at 90.121.111.5.
After the connection is opened, the browser sends the request in correctly for-
matted HTTP. In the example, the request is for a file called resume.html. The
browser looks for and finds the file resume.html in its root directory, where it serves
files. The Web server reads the file and creates a response. Included in the response
is the output type that is being returned to the browser. A Multipurpose Internet
Media Extension (MIME) type placed in the response provides information about
Search WWH ::




Custom Search