epubjs
Version:
Render ePub documents in the browser, across many devices
33 lines (32 loc) • 3.59 kB
HTML
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Uniform Resource Locators (URLs)</title><link rel="stylesheet" href="core.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"/></head><body><div class="sect1" title="Uniform Resource Locators (URLs)"><div class="titlepage"><div><div><h1 class="title"><a id="learnjava3-CHP-14-SECT-1"/>Uniform Resource Locators (URLs)</h1></div></div></div><p><a id="idx10817" class="indexterm"/> <a id="idx10825" class="indexterm"/> <a id="idx10836" class="indexterm"/> A URL points to an object on the Internet. It’s a text
string that identifies an item, tells you where to find it, and specifies
a method for communicating with it or retrieving it from its source. A URL
can refer to any kind of information source. It might point to static
data, such as a file on a local filesystem, a web server, or an FTP site;
or it can point to a more dynamic object such as an RSS news feed or a
record in a database. URLs can even refer to more dynamic resources such
as communication sessions and email addresses.</p><p>Because there are many different ways to locate an item on the Net
and different mediums and transports require different kinds of
information, URLs can have many forms. The most common form has four
components: a network host or server, the name of the item, its location
on that host, and a protocol by which the host should communicate:</p><a id="I_14_tt898"/><pre class="programlisting"> <em class="replaceable"><code><code class="nl">protocol:</code><code class="c1">//hostname/path/item-name</code></code></em></pre><p><em class="replaceable"><code>protocol</code></em> (also called the “scheme”) is an
identifier such as <a id="I_indexterm14_id773208" class="indexterm"/><code class="literal">http</code> or <code class="literal">ftp</code>; <em class="replaceable"><code>hostname</code></em> is
usually an Internet host and domain name; and the
<em class="replaceable"><code>path</code></em> and <em class="replaceable"><code>item</code></em>
components form a unique path that identifies the object on that host.
Variants of this form allow extra information to be packed into the URL,
specifying, for example, port numbers for the communications protocol and
fragment identifiers that reference sections inside documents. Other, more
specialized types of URLs such as “mailto” URLs for email addresses or
URLs for addressing things like database components may not follow this
format precisely, but do conform to the general notion of a protocol
followed by a unique identifier. (Some of these would more properly be
called URIs, which we’ll discuss later.)</p><p>Because most URLs have the notion of a hierarchy or path, we
sometimes speak of a URL that is relative to another URL, called a
<span class="emphasis"><em>base URL</em></span>. In that case, we are using the base URL as
a starting point and supplying additional information to target an object
relative to that URL. For example, the base URL might point to a directory
on a web server and a relative URL might name a particular file in that
directory or in a subdirectory.<a id="I_indexterm14_id773259" class="indexterm"/><a id="I_indexterm14_id773266" class="indexterm"/><a id="I_indexterm14_id773274" class="indexterm"/></p></div></body></html>