How can a URI contain a URN as well as a URL?
Are there any examples of a URI that contains both a URN and URL?
http://tools.ietf.org/html/rfc3986#section-1.1.3
A URI can be further classified as a locator, a name, or both.
And which would be the URI scheme then? "urn:" or a URL specific scheme?
Or am I reading it wrong and does it mean a URL can be a URN (or vice versa), eg the URI can be used as URN as well as URL.
Read the rest of that section of that RFC:
1.1.3. URI, URL, and URN
A URI can be further classified as a locator, a name, or both. The term "Uniform Resource Locator" (URL) refers to the subset of URIs that, in addition to identifying a resource, provide a means of locating the resource by describing its primary access mechanism (eg, its network "location"). The term "Uniform Resource Name" (URN) has been used historically to refer to both URIs under the "urn" scheme [RFC2141], which are required to remain globally unique and persistent even when the resource ceases to exist or becomes unavailable, and to any other URI with the properties of a name.
An individual scheme does not have to be classified as being just one of "name" or "locator". Instances of URIs from any given scheme may have the characteristics of names or locators or both, often depending on the persistence and care in the assignment of identifiers by the naming authority, rather than on any quality of the scheme. Future specifications and related documentation should use the general term "URI" rather than the more restrictive terms "URL" and "URN" [RFC3305].
Which is to say, URIs can be URLs or URNs, or in some cases, qualify as both at the same time. "URL" and "URN" are just terms for how the URI is intended to be interpreted and used in a given context.
I would argue that URIs of the common http
and https
schemes are always both locators and names.
https://example.com/some_resource?color=green
This is because they assign a name to a resource, even though the name might be cryptic and not what a human would prefer as a name. Also, as the same resource could easily be available by another of these URIs, there is no guarantee that this is the only name of the resource.
Furthermore all of them contain an authority and so they describe a network path where the resource can be found, which would make them a locator.
链接地址: http://www.djcxy.com/p/70110.html