什么是URI(统一资源标识符)?

Uniform Resource Identifier or URI is a string of characters that identify specific resources. URI is like an address or Social security number of an entity which can be a web page or a file or a book. URI is generally used in IT and WWW for different types of object identification.

Uniform Resource IdentifierURI是标识特定资源的字符串。 URI就像是实体的地址或社会安全号码,可以是网页,文件或书籍。 URI通常在IT和WWW中用于不同类型的对象标识。

URI标准RFC 3986 (URI Standard RFC 3986)

URI is defined in RFC 3986 as a standard. URI dates back to 1990 and defined in RFC1630 it is updated regularly. With the RFC 3986, all previously URI related standards became absolute.

URI在RFC 3986中定义为标准。 URI的历史可以追溯到1990年,并在RFC1630中定义,并且会定期更新。 有了RFC 3986,所有以前与URI相关的标准就变成了绝对的。

Uniform means using a single form for all different types which can be used for all of them without any exception and change.

Uniform是指对所有不同类型使用单一形式,所有形式都可以使用而没有任何例外和更改。

Resource means anything which can be used as a resource or some object useful.

Resource是指可以用作资源或有用对象的任何东西。

Identifier means identifying the given entity or object uniquely or in a group manner according to the situation.

Identifier是指根据情况唯一或以组的方式识别给定的实体或对象。

URI语法 (URI Syntax)

URI provides a complete and uniform syntax where everything can be defined with complying with this syntax.

URI提供了完整而统一的语法,其中所有内容都可以通过遵守该语法进行定义。

scheme://[[email protected]]host[:port]]path[?query][#fragment]

Scheme is the protocol or scheme which will be used to connect or access to the resource. The scheme can be http, https, ftp, ldap, mailto, tel, telnet, ssh, etc. As we see that all of them provide a standardized protocol for communications and network transmission.

Scheme是将用于连接或访问资源的协议或方案。 该方案可以是http,https,ftp,ldap,mailto,tel,telnet,ssh等。正如我们所看到的,它们都提供了用于通信和网络传输的标准化协议。

User and Password are optional parameters where they can be omitted according to the usage. But can be used for situations like authentication to access a restricted resource. For example, to access HTTP basic authentication protected resource we should provide the username and password.

UserPassword是可选参数,可以根据用法将其省略。 但是可用于诸如访问受限资源的身份验证之类的情况。 例如,要访问受HTTP基本身份验证保护的资源,我们应提供用户名和密码。

Host is an important part where the remote resource host is provided with this parameter. We can use IP address or domain name for the host in general but another type of host definition can be used for different cases.

Host是向远程资源主机提供此参数的重要部分。 通常,我们可以为主机使用IP地址或域名,但在不同情况下也可以使用另一种类型的主机定义。

LEARN MORE  How To Install WinSCP Into Windows Operating Systems?
了解更多如何将WinSCP安装到Windows操作系统?

Port is optional but we can specify the port explicitly. Port is generally related to the scheme where HTTP protocol uses port number 80, https 443 by default. If the port is default one we can skip the port parameter but if different from the default we should provide it explicitly.

Port是可选的,但我们可以显式指定端口。 端口通常与HTTP协议默认使用端口号80(https 443)的方案有关。 如果端口是默认端口,我们可以跳过端口参数,但是如果与默认端口不同,我们应该明确提供它。

Path is another important parameter where the precise location of the resource is specified on the host. The host provides the generic address or node where path provides the precise address like index.html or /users/ismail etc.

在主机上指定资源的精确位置的地方, Path是另一个重要参数。 主机提供通用地址或节点,路径提供精确的地址,例如index.html/users/ismail等。

Query is used to provide different types of inputs and parameters into the specified resource or path. This is especially useful for dynamic web pages to provide parameters.

Query用于向指定的资源或路径提供不同类型的输入和参数。 这对于动态网页提供参数特别有用。

Fragment is not used so much is can be useful to specify some pages of the remote resource or path. The specific area of a web page can be specified with a fragment.

Fragment未使用太多,可以用于指定远程资源或路径的某些页面。 网页的特定区域可以用片段指定。

URI范例 (URI Examples)

URI can be used to specify different objects or resources. URI is especially used for the identification of web pages, mail addresses, telnet connections, phone numbers, LDAP connections.

URI可用于指定不同的对象或资源。 URI特别用于标识网页,邮件地址,telnet连接,电话号码,LDAP连接。

Http Uri (Http Uri)

http://www.poftut.com/what-is-a-query-database-query/

http is the protocol part which means this resource can be accessed by using the HTTP protocol.

http是协议部分,这意味着可以使用HTTP协议访问此资源。

www.poftut.com is the host part which provides the fully qualified domain name.

www.poftut.com是提供完全限定域名的主机部分。

what-is-a-query-database-query is the path which specified the resource on the given host.

what-is-a-query-database-query是在给定主机上指定资源的路径。

We can see that the resource is specified with only protocol, host and path parameters. But we can also specify this URI like below.

我们可以看到仅通过协议,主机和路径参数指定了资源。 但是我们也可以像下面这样指定此URI。

http://172.104.31.121/what-is-a-query-database-query/

http://172.104.31.121:80/what-is-a-query-database-query/ 

http://www.poftut.com:80/what-is-a-query-database-query/ 

Https Uri(Https Uri)

Https is the secure version of the Http. So most of the Uri parts are the same as the Http. We will just use https according to http like below.

Https是Http的安全版本。 因此,大多数Uri部分与Http相同。 我们将仅根据http使用https ,如下所示。

https://www.poftut.com/what-is-a-query-database-query/

https is the protocol part which means this resource can be accessed by using the HTTPS protocol.

https是协议的一部分,这意味着可以使用HTTPS协议访问此资源。

www.poftut.com is the host part which provides the fully qualified domain name.

www.poftut.com是提供完全限定域名的主机部分。

LEARN MORE  TCP and UDP Port List, Names and Usage Frequency
了解更多TCP和UDP端口列表,名称和使用频率

what-is-a-query-database-query is the path which specified the resource on the given host.

what-is-a-query-database-query是在给定主机上指定资源的路径。

We can see that the resource is specified with only protocol, host and path parameters. But we can also specify this URI like below.

我们可以看到仅通过协议,主机和路径参数指定了资源。 但是我们也可以像下面这样指定此URI。

https://172.104.31.121/what-is-a-query-database-query/

https://172.104.31.121:80/what-is-a-query-database-query/ 

https://www.poftut.com:80/what-is-a-query-database-query/ 

Ftp Uri(Ftp Uri)

File transfer protocol or Ftp is used to download and upload files to the FTP servers.

文件传输协议或Ftp用于将文件下载和上传到FTP服务器。

ftp://poftut.com/linux.gz

ftp is the protocol name

ftp是协议名称

poftut.com is the hostname

poftut.com是主机名

linux.gz is the resource path which is a gzipped file named Linux.

linux.gz是资源路径,它是一个名为Linux的压缩文件。

LDAP Uri (LDAP Uri)

LDAP is a protocol used to manage users, systems access and authentication. LDAP resources can be specified with Uri.

LDAP是用于管理用户,系统访问和身份验证的协议。 可以使用Uri指定LDAP资源。

ldap://[2001:db8::7]/c=GB?objectClass?one

ldap is the protocol name.

ldap是协议名称。

[2001:db8::7] is the host which is an IPv6 address.

[2001:db8::7]是作为IPv6地址的主机。

c=GB is the path for the remote resource.

c=GB是远程资源的路径。

objectClassand one are the query for the specified path.

objectClassone是对指定路径的查询。

邮件乌里 (Mail Uri)

Mail addresses are specified with Uri form like below. They are a bit different from HTTP and LDAP specification.

邮件地址使用Uri格式指定,如下所示。 它们与HTTP和LDAP规范有些不同。

mailto:[email protected]

mailto is the protocol that is mail address for this case.

mailto是这种情况下的邮件地址协议。

ismail.baydan is the username of the mail user.

ismail.baydan是邮件用户的用户名。

kaleinfo.com is the host of the mail user.

kaleinfo.com是邮件用户的主机。

Telnet Uri (Telnet Uri)

Telnet connections can be specified with URI like below.

可以使用如下所示的URI指定Telnet连接。

telnet://192.168.1.1:2323

telnet is the protocol of the remote resource.

telnet是远程资源的协议。

192.168.1.1 is the host or IP address of the resource.

192.168.1.1是资源的主机或IP地址。

2323 is the port number of the remote telnet resource where 23 is the default telnet number. But this port number is specified explicitly because it is different from 23.

2323是远程telnet资源的端口号,其中23是默认telnet号。 但是此端口号是明确指定的,因为它不同于23。

文件Uri (File Uri)

Files on a disk can be also specified with URI.

磁盘上的文件也可以使用URI指定。

file://c:\users\presentation.ppt

file is the protocol or type of the given resource.

file是给定资源的协议或类型。

c:\ is the host of the given resource which is a disk partition.

c:\是给定资源的主机,该资源是磁盘分区。

LEARN MORE  How To Install, Configure, and Run Linux Tftp Client?
了解更多如何安装,配置和运行Linux Tftp Client?

users\presentation.ppt is the path of the given resource which also contains the file name with extension.

users\presentation.ppt是给定资源的路径,还包含带有扩展名的文件名。

翻译自: https://www.poftut.com/what-is-uri-uniform-resource-identifier/

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值