Understanding Uri,url,urn

Source: Internet
Author: User
Tags rfc

In the web domain, we are familiar with three professional vocabulary uri,url,urn, for these three words we may know its original intention, its relationship with each other, but for Uri,urn there is always a layer of hazy sense, because the URI is abstract concept, and URN away from the reality of development. Here are some analysis of these 3 concepts to try to clarify their internal logic.

First you need to know IETF,RFC

Before we know the 3 professional nouns above, we need to understand the IETF and RFC, because both define ur*. The IETF is the Internet Engineering Task Force (the Internet, Engineering), which is an international civil organization that standardizes the technology of the Web. The RFC is a submit request (requests for Comments), which is a series of numbered files. RFC documents can be divided into three types:

    • BCP Best practice practice.
    • FYI for Your information, informational documents, for discussion only.
    • STD standards, standard documentation.

The IETF is the organization that defines Uri,url,urn, and the RFC is a standard file that defines Uri,url,urn.

Reference:
RFC2026 https://datatracker.ietf.org/doc/rfc2026/
RFC Wiki Https://zh.wikipedia.org/wiki/RFC

Url

URL is the abbreviation of Uniform Resource Locator, which provides a unified scheme for locating resources in a network. It has the following common formats:

<scheme>://<user>:<password>@

URLs are our most common concept that is always accessible during development. That is, a string that represents the address of a network resource in the format above. There is also a relative URL, which is not described in detail here.
A URL is a resource address in the web, analogous to a real-world address.

Reference:
URL definition RFC1738 https://www.w3.org/Addressing/rfc1738.txt
URL explanation URL and resources "HTML authoritative guide" chapter II

Urn

A URN is an abbreviation for a Uniform Resource name that provides a uniform scheme for the names of resources in a network. It requires the world to be unique and remains the same if the resource does not exist or is no longer available. It has the following format:

"urn:" <NID> ":" <NSS>

Urn based on the idea that the URL in the network will not last, as people may move, network resources may also be moved, resulting in URL invalidation. The basic idea is to introduce a persistent layer urn, just like a person's life will not be renamed, so you can avoid the problem of URL failure. The urn takes certain policies to implement the mapping of the urn to the actual resource, but this is not a consideration.

More than 20 years ago the urn does not seem to have practical value, it is very normal, technical development of many technical standards are silent in history. But it does not necessarily mean that it is worthless, like the early popular soap in web development, which later returns to the restful nature of HTTP's original semantics. Now it is necessary to understand the urn because it is bound to Url,uri, so it must be known. In my opinion, the urn was not used because:

    • Urns and URLs are incompatible scenarios.
    • Search engines, site search, mobile internet and so on, users do not care to remember the URL (urn is the same). URLs are the underlying infrastructure of the web, and the cost of making changes is high and yields are low.
    • URL persistence is not as bad as it might seem, and a reasonable URL plan can satisfy the functionality expected by the urn.
    • Users are accustomed to URLs, and using urns can lead to learning costs.

In short, many years of practice, the URL is not as bad as imagined, the urn is not as good as imagined.

The name of the person/institution that is analogous to the real thing, and the urn is the name of the resource in the Web.

Reference:
Urn discussion: RFC1737 http://www.ietf.org/rfc/rfc1737.txt
Urn Syntax: RFC2141 http://www.ietf.org/rfc/rfc2141.txt
URN history: The HTML authoritative Guide chapter II 2.6 Future Outlook
Distinguish URIs, URLs, and Urn:https://www.ibm.com/developerworks/cn/xml/x-urlni.html#artrelatedtopics

Uri

URIs are abbreviations for Uniform Resource identifiers, which are a uniform abstraction of URLs and urns, and URIs provide a simple and extensible means of identifying resources. In its definition, a URI can be used as a locator, a name, or a combination of both. The common URI syntax consists of scheme (scheme), Authority (authority), Path (path), query, and Fragment (fragment):

      URI         = scheme ":" hier-part [ "?" query ] [ "#" fragment ]      hier-part   = "//" authority path-abempty                  / path-absolute                  / path-rootless                  / path-empty

You can see that there is a certain difference between a URL and a URI from a syntactic level. For more on the syntax differences, you can read the RFC documentation in detail.
The name and address used to identify the person, the URL, and the urn are used for identifying the resource, thus unifying the URI.

Reference:
URI discussion: RFC1630 https://www.w3.org/Addressing/rfc1630.txt
URI syntax: RFC3986 https://tools.ietf.org/html/rfc3986

Use a URI or URL? Since urns do not currently have practical value, it is easy to confuse the concept with URIs and URLs only. As an application developer, the difference between URIs and URLs is usually only named, and my view is:
    • According to the API to name, what to give, what.
    • A specific resource location is typically required in the web, so URLs are generally used
Summarize

This article analyzes the specific definitions of Url,urn,uri and their actual usage. The standard is very meaningful in abstract and conceptually, but in actual development, the fact is often seen.

Even at the end of this article, Url,uri,urn in my heart still tangled together, like XML in my heart, this is more abstract than the definition of the first, related documents are more confusing. Fortunately, the actual use does not need to be too tangled, unless involved in the underlying development, to understand this level.

Some people will take some language, the library to the understanding of Uri,url as to uri,url understanding, I think this way is not very correct. The understanding of Uri,url by language and library can be regarded as a self-understanding of the relevant concepts of RFC definition by its developers, with certain practical value, but the essence is two times knowledge.

Understanding Uri,url,urn

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.