URIs come in two flavors, called URLs and URNs

   URIs

Each web server resource has a name, so clients can point out what resources they are interested in. The server resource name is called a uniform resource identifier, or URI. URIsare like the postal addresses of the Internet, uniquely identifying and locating information resources around the world.

 

Figure 1 shows how the URI specifies the HTTP protocol to access the saw-blade GIF resource on Joe's store's server. Given the URI, HTTP can retrieve the object. URIs come in two flavors, called URLs and URNs. Let's take a peek at each of these types of resource identifiers now.

Figure 1. URLs specify protocol, server, and local resource

 

      URLs

The uniform resource locator (URL) is the most common form of resource identifier. URLs describe the specific location of a resource on a particular server. They tell you exactly how to fetch a resource from a precise, fixed location. Figure 1 shows how a URL tells precisely where a resource is located and how to access it. Table 1 shows a few examples of URLs.

Table 1. Example URLs

URL

Description

http://www.xxx.com/index.html

The home URL for O'Reilly & Associates, Inc.

http://www.xxx.com/images/logo.gif

The URL for the Yahoo! web site's logo

http://www.xxx.com/inventory-check.cgi?item=12731

The URL for a program that checks if inventory item #12731 is in stock

ftp://username:[email protected]/locking-pliers.gif

The URL for the locking-pliers.gif image file, using password-protected FTP as the access protocol

Most URLs follow a standardized format of three main parts:

·        The first part of the URL is called the scheme, and it describes the protocol used to access the resource. This is usually the HTTP protocol (http:// ).

·        The second part gives the server Internet address (e.g., www.xxx.com).

·         The rest names a resource on the web server (e.g., /specials/saw-blade.gif ).

Today, almost every URI is a URL.

     URNs

The second flavor of URI is the uniform resource name, or URN. A URN serves as a unique name for a particular piece of content, independent of where the resource currently resides. These location-independent URNs allow resources to move from place to place. URNs also allow resources to be accessed by multiple network access protocols while maintaining the same name.

For example, the following URN might be used to name the Internet standards document "RFC 2141" regardless of where it resides (it may even be copied in several places): urn:ietf:rfc:2141

URNs are still experimental and not yet widely adopted. To work effectively, URNs need a supporting infrastructure to resolve resource locations; the lack of such an infrastructure has also slowed their adoption. But URNs do hold some exciting promise for the future.

 

In short,URLs identify resources by describing where resources are located, whereas URNs identify resources by name,regardless of where they currently reside.


 

你可能感兴趣的:(urls,URIs,URNs)