A Uniform Resource Locator (URL) is an identifier that points to a resource that is accessible electronically, such as a file in a directory on a machine on a network or documents stored in databases.
URLs are in the format scheme:scheme_information.
A scheme might be http
, ftp
, file
, or
another term that identifies the type of resource and the mechanism by which the
resource can be accessed. In a World Wide Web browser's location or address
box, a URL for a file available using HyperText Transfer Protocol (HTTP) starts with
http:
. An example is http://www.ibm.com
. Files available
using File Transfer Protocol (FTP) start with ftp:
. Files available
locally start with file:
.
The scheme_information commonly identifies the Internet machine making a
resource available, the path to that resource, and the resource name. The
scheme_information for HTTP, FTP and file generally starts with two slashes (//),
then provides the Internet address separated from the resource's path name
with one slash (/). For example,
http://www-4.ibm.com/software/webservers/appserv/library.html
.
For HTTP and FTP, the path name ends in a slash when the URL points to a directory.
In such cases, the server generally returns the default index for the directory.
A URL provider implements the functionality for a particular URL protocol, such as HTTP. It is a pair of classes that extend java.net.URLStreamHandler and java.net.URLConnection.