RFC 3986 URI的结构

mpeg dash 的element BaseURL语法规则遵循RFC 3986,需要做简单了解:

I.1 URI各个部分的名称

foo://example.com:8042/over/there?name=ferret#nose

\_/   \______________/\_________/ \_________/ \__/

|                   |                          |                     |             |

scheme     authority                    path              query   fragment

|   _________________________|__

/ \ /                                           \

urn:example:animal:ferret:nose

scheme:协议的名称,以字母开头,后接任意个字母/数字/+/-/.的组合。

scheme      = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

authority:以双斜线”//”开始但不包括”//”, 以紧接着的第一个’/’或者?或者#(#在这里

叫着number sign)结束但不包括该符号,或者一直到URL结束为止。

authority   = [ userinfo "@" ] host [ ":" port ]

[]内的部分是可选部分。

path: 在authority之后,以/开头,以紧接着的第一个?或者#结束或者直到URL结束为止。

query:以?开头,以紧接着的第一个#结束,或者直到URL结束为止,query常常以

“key=value”的形式来携带一些认证信息。

fragment: 以#开头,直到URL结束为止。Fragment常用于标记一个参考主要资源的次要

资源。

I.2 URI的参考规则

URI-reference:URI-reference可能是URI或者relative-reference,当URI-reference的前缀不

匹配scheme的语法时,表明URI-reference是一个relative-reference。

Relative-reference所参考的URI叫target URI。

在mpeg dash中,暂时只需要知道BaseURL可能需要参考上级的BaseURL来组合成一个完整的http链接即可,如下:

<?xml version="1.0"?>

<MPD

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns="urn:mpeg:DASH:schema:MPD:2011"

xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd"

type="static"

mediaPresentationDuration="PT3256S"

minBufferTime="PT1.2S"

profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">

<BaseURL>http://cdn1.example.com/</BaseURL>

<BaseURL>http://cdn2.example.com/</BaseURL>

<Period>

<!-- English Audio -->

<AdaptationSet mimeType="audio/mp4" codecs="mp4a.0x40" lang="en" subsegmentAlignment="true"

subsegmentStartsWithSAP="1">

<ContentProtection schemeIdUri="urn:uuid:706D6953-656C-5244-4D48-656164657221"/>

<Representation id="1" bandwidth="64000">

<BaseURL>7657412348.mp4</BaseURL>

</Representation>

<Representation id="2" bandwidth="32000">

<BaseURL>3463646346.mp4</BaseURL>

</Representation>

</AdaptationSet>

</Period>

</MPD>

访问两个MP4文件的HTTP URL需要组合MPD中的BaseURL和Representation中的BaseURL:

http://cdn1.example.com/7657412348.mp4

http://cdn1.example.com/3463646346.mp4

或者

http://cdn2.example.com/7657412348.mp4

http://cdn2.example.com/3463646346.mp4

时间: 2024-08-24 17:32:52

RFC 3986 URI的结构的相关文章

异常:Invalid character found in the request target. The valid characters are defined in RFC 3986

一.背景 事情是这样的,前几天做一个基本的数据库“增删改查”的需求,前端传参的方式是“JSON字符串”,后端接收到此参数后,使用阿里巴巴fastjson进行解析,然后入库.需求很简单吧,但是偏偏遇到问题了. 我发现,JSON字符串里面无数组,纯粹的都是json结构的时候,即都是“{}”时,不会报错,传参入库没问题.但是只要传参的值里面有数组,即有“[]”的结构时,就报错.报错内容如下(我的tomcat版本是8.5.45): java.lang.IllegalArgumentException:

The valid characters are defined in RFC 7230 and RFC 3986

Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level. java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986 at org.apache.coyote.h

java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

微信小程序前后台使用get方式传参时报错如图.但在微信开发平台和苹果测试都没事,在安卓手机上就报这个错,猜想原因是get传递了汉字的原因. 尝试了下在后台输出从前台获取的参数,但是后台什么也没有获取到,直接报错. 最后用id替换了url里的中文:因为搜索功能不能替换中文的,改成了post请求. 参考:[Java EE]get和post请求的编码过程get请求中文参数乱码的解决之道 网上也有很多报这个错的原因是含有特殊字符:有些版本的Tomcat严格按照 RFC 3986规范进行访问解析,而 RF

springboot 内置默认启动tomcat容器遇到The valid characters are defined in RFC 7230 and RFC 3986”

URL: http://127.0.0.1:8081/test?urlcount=2&countcname1=参数名1&countname1=参数1&countcname2=参数名2&countname2=参数2 后台模拟post请求时路径报错: The valid characters are defined in RFC 7230 and RFC 3986" 原因是因为url中含有中文. 直接进行中文转义: URLEncoder.encode(参数名1,&qu

异常解决:Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

前言: 在用IE浏览器时访问tomcat项目时,页面报400错误,后台错误: java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986 在网上查得资料时因为Tomcat版本在7以后会对http请求进行验证 解决办法: 1.使用encodeURI函数,因为IE浏览器无法对URL

Tomcat 8 Invalid character found in the request target. The valid characters are defined in RFC 3986

终极解决方案: Invalid character found in the request target. The valid characters are defined in RFC 3986 25-Aug-2018 11:27:27.086 信息 [http-nio-8087-exec-5] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header Note: further oc

URI, URL, and URN

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 desc

Win8 URI 方案 ms-appX 用法大全

ms-appdata://可以引用来自应用的本地.漫游和临时数据文件夹中的应用文件ms-appdata:///local/hello/logo.png ms-appx://可以引用来自应用包的应用文件ms-appx://[email protected]/default.html ms-resource://可以引用应用资源,通常是字符串资源 ms-resource://[email protected]/Resources/String1 可以使用 URI(统一资源标识符)方案引用来自应用包.

你知道URL、URI和URN三者之间的区别吗

这是一个经典的技术争论,许多人都会自问:URL.URI,很可能还有URN,它们之间的区别是什么.虽然,现在我们简单地把 URN 和 URL 都看做 URI,但严格来说URI可以进一步划分为URL.URN或者这两者的组合,所以了解这三者之间的区别将会非常有趣并让人受益匪浅.如果你恰好在某个地方碰到了这些东西,那么至少应该知道它们的含义. 我认为,尽管对一般人来说,不了解这三个缩略词之间的技术差异以及它们各自的含义并不是什么问题.但是,如果你作为一个计算机科学家.一个Web开发者.一个系统管理员,或