Java Servlets   «Prev 

Dissecting HTTP URL

Dissecting a URL
Dissecting a URL containing the following elements:
  1. protocol
  2. host name
  3. path and filename

URL broken up

A URL can be broken up into several features. While some of the features of a URL are optional, other elements are required to access a webpage or file on a website.
Transfer Protocol: this element of a URL can take on many forms which represent the protocol for how data from a webpage will be transferred to a browser or client. Examples include http, https, and ftp. Most ordinary websites use http or https, and any vital information should be transferred via https. Common transfer protocols include:
  1. http -Hypertext transfer protocol
  2. https - HTTP Secure protocol
  3. ftp - File Transfer Protocol


Domain Name: also known as website name or host name, the domain name element of a URL is often three parts:
  1. www (optional),
  2. second level name (i.e. ooportal in www.ooportal.com), and
  3. top level name(.com, .org, .edu, .net).

The domain name is an instruction telling your browser where to go to download the requested webpage. The 'www' portion is optional and in most cases one can load a website with or without the www and receive the same content. This is not always the case however: in many cases using one domain name may redirect a browser to the other format
(eg ooportal.com redirects to www.ooportal.com). 

The top level domain often defines the type of website, some of the more regulated names include:
  1. edu - academic/educational site, typically a college or university.
  2. .gov - A website owned and operated by the government.
  3. .org - An organization

Port: The port is often omitted from a URL, and when omitted assumed to be port 80. When present the port occurs after the domain name, delimited from the domain name by a colon (for example, www.dispersednet.com:8080). A port is a communication point through which two computers communicate, the designation in the context of a URL defines which port to access on a website host.

File name: the file name element of a URL is everything after the domain name, but before the file name ending (below). This is typically a path to a file located on the web server.
File Format:
often .html, but in many other cases can be .php, .cgi, .html.
The file format often depicts how the web server provides the content. For example, a .php ending is indicative that the webpage is being served by a php 'engine' - a scripting language which facilitates 'dynamic' webpages (pages which are physically one file but present different information depending upon given options).
  1. .html - Hypertext markup language
  2. .php - PHP hypertext processor
  3. .cgi - Common Gateway Interface
  4. .jpg/jpeg - jpg (pronounced 'jpeg') is an image file format, perhaps the most common on the internet today.