zoukankan      html  css  js  c++  java
  • URI与URL

    背景

    项目需要自己构造一个URI Scheme,但是不知道URI是什么,以及Scheme的命名方式,所以找了以下资料。

    资料

    URL非常好理解,因为很常见,它是用于网络上定位互联网上Web资源的,如网上的某个图片,某个mp3或某个H5页面的地址。
    举例:http://www.baidu.com/img/bdlogo.png

    而URI和URL并不等同,定义如下

    URI:Uniform resource identifier 统一资源标识符

    URL:Uniform resource locator 统一资源定位符

    维基百科:

    The most common form of URI is the uniform resource locator (URL)

    所以URL是URI的子集

    URI是一个资源定位符,并不一定是网络上的,它可以是你本机上的。

    举例:

    https://example.org/absolute/URI/with/absolute/path/to/resource.txt
    ftp://example.org/resource.txt
    ed2k://|file|%5BMAC%E7%89%88%E6%9E%81%E5%9

    URI Scheme是一个规范,所以符合它的规范的都可以称之为URI Scheme,所以我们也可以设计自己的scheme。

    scheme:[//[user:password@]domain[:port]][/]path[?query][#fragment]

    <scheme name> : <hierarchical part> [ ? <query> ] [ # <fragment> ]

    <scheme name>:scheme的名称,对于上面3个scheme,它们scheme名分别是http, ftp, ed2k(电驴协议)

    <hierarchical part>:路径名,一般为authority+path,见下图即知

    <query>:查询字段,一般为键值对,参考URL即知

    <fragment>:可选字段,经常看到网页中用来回到顶部的就是这个啦

    关于Scheme的命名方式,维基百科如是说 

    The scheme consists of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-). Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters.

  • 相关阅读:
    Unity 3(一):简介与示例
    MongoDB以Windows Service运行
    动态SQL中变量赋值
    网站发布IIS后堆栈追踪无法获取出错的行号
    GridView Postback后出错Operation is not valid due to the current state of the object.
    Visual Studio 2010 SP1 在线安装后,找到缓存在本地的临时文件以便下次离线安装
    SQL Server 问题之 排序规则(collation)冲突
    IIS 问题集锦
    linux下安装mysql(ubuntu0.16.04.1)
    apt-get update 系列作用
  • 原文地址:https://www.cnblogs.com/chenyg32/p/4790365.html
Copyright © 2011-2022 走看看