URI, URL, URN

来源:互联网 发布:写安卓软件 编辑:程序博客网 时间:2024/05/21 05:55

URI Euler Diagram



URI(Uniform Resource Identifier, 即统一资源标识符), 通过名字或者是地址来标识一个资源。


 

图书馆的一本书(资源)。书的编号4144371可以标识这本书,计算机技术>电子电工>嵌入式系统>书架F>第一排>右边数第三本 也可以标识这本书。前者是通过名字后者是通过地址。


URL(Uniform Resource Locator, 即统一资源定位符), 定义了如何获取这个资源。表示URL的语法是这样的: 

scheme://username:password@domain:port/path?query_string#fragment_id


URN(Uniform Resource Name, 即统一资源名称), 定义了资源的id。表示URN的语法是这样的:

<URN> ::= "urn:" <NID> ":" <NSS>


URL 和 URN 是 URI的子集。

下面是一些例子:

  • URL: ftp://ftp.is.co.za/rfc/rfc1808.txt
  • URL: http://www.ietf.org/rfc/rfc2396.txt
  • URL: ldap://[2001:db8::7]/c=GB?objectClass?one
  • URL: mailto:John.Doe@example.com
  • URL: news:comp.infosystems.www.servers.unix
  • URL: telnet://192.0.2.16:80/
  • URN (not URL): urn:oasis:names:specification:docbook:dtd:xml:4.1.2
  • URN (not URL): tel:+1-816-555-1212 (?)


参考:
  1. https://en.wikipedia.org/wiki/Uniform_resource_identifier
  2. http://stackoverflow.com/questions/176264/what-is-the-difference-between-a-uri-a-url-and-a-urn
  3. http://stackoverflow.com/questions/4913343/what-is-the-difference-between-uri-url-and-urn?rq=1
  4. http://baike.baidu.com/item/URI/2901761



0 0
原创粉丝点击