Tag: uri

如何构build相对于页面URI的WebSocket URI?

我想在浏览器端构build一个相对于页面URI的WebSocket URI。 说,在我的情况下,转换HTTP URI像 http://example.com:8000/path https://example.com:8000/path 至 ws://example.com:8000/path/to/ws wss://example.com:8000/path/to/ws 我现在正在做的是用“ws”replace前4个字母“http”,并附加“/ to / ws”。 有没有更好的办法呢?

你如何创build一个没有(到)部分的mailto:链接

你如何正确构build一个没有部分的mailto:链接。 mailto:someaddress@example.com? 我不想要的地址,只是想通过邮件填写参数之后什么。

URI无效:无法确定URI的格式

我不断收到这个错误。 URI无效:无法确定URI的格式。 我有的代码是: Uri uri = new Uri(slct.Text); if (DeleteFileOnServer(uri)) { nn.BalloonTipText = slct.Text + " has been deleted."; nn.ShowBalloonTip(30); } 编辑:slct.Text中的内容是ftp.jt-software.net/style.css 。 是什么赋予了? 这不是一个有效的URI格式? 这是纯文本。

什么是有效的,什么不在URI查询中?

背景(进一步的问题) 我一直在谷歌searchRFC和SO试图破解这个问题,但我仍然没有杰克。 所以我想我们只是投票“最好”的答案,就是这样,或? 基本上归结到这一点。 3.4。 查询组件 查询组件是由资源解释的一串信息。 query = *uric 在查询组件中,字符“;”,“/”,“?”,“:”,“@”,“&”,“=”,“+”,“,”和“$”被保留。 第一件令我难以置信的事就是* uric就是这样定义的 uric = reserved | unreserved | escaped reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," 但是,这样的说法可以稍微澄清一些 上面的“保留”语法类是指URI内允许使用的那些字符,但在通用URI语法的特定组件中可能不允许使用这些字符。 它们被用作第3节中描述的组件的分隔符。 “保留”集中的字符在所有上下文中都不保留。 在任何给定的URI组件中实际保留的字符集由该组件定义。 一般来说,如果URI的语义由于其US-ASCII编码而被replace,则字符被保留。 这最后的摘录感觉有些落后,但它清楚地表明,保留的字符集取决于上下文。 然而,3.4声明所有的保留字符都是保留在一个查询组件中的,但是,唯一会改变这里的语义的是逃避问号(?),因为URI没有定义查询string的概念。 在这一点上,我完全放弃了RFC,但发现RFC 1738特别有趣。 一个HTTP URL的格式如下: http://<host>:<port>/<path>?<searchpart> 在<path>和<searchpart>组件中,“/”,“;”,“?” […]

如何从string创buildWeb Worker

我如何使用从string(通过POST请求提供)创buildWeb Worker? 我能想到的一种方式,但我不知道如何实现它,是从服务器响应创build一个数据URI,并将其传递给工人的构造函数,但我听说有些浏览器不允许这是因为相同的来源政策。 MDN指出围绕数据URI的原始策略的不确定性 : 注意:作为Worker构造函数parameter passing的URI必须遵守同源策略。 浏览器供应商目前在数据URI是否是同源的方面存在分歧, Gecko 10.0(Firefox 10.0 / Thunderbird 10.0)及更高版本允许数据URI作为工作者的有效脚本。 其他浏览器可能会不同意。 这里也有一个post, 讨论它在whatwg 。

在Uri中replace主机

使用.NETreplaceUri的主机部分的最好方法是什么? 即: string ReplaceHost(string original, string newHostName); //… string s = ReplaceHost("http://oldhostname/index.html", "newhostname"); Assert.AreEqual("http://newhostname/index.html", s); //… string s = ReplaceHost("http://user:pass@oldhostname/index.html", "newhostname"); Assert.AreEqual("http://user:pass@newhostname/index.html", s); //… string s = ReplaceHost("ftp://user:pass@oldhostname", "newhostname"); Assert.AreEqual("ftp://user:pass@newhostname", s); //etc. System.Uri似乎没有什么帮助。

如何在Android中获得一个图像资源的URI

我需要打开一个意图来查看图像,如下所示: Intent intent = new Intent(Intent.ACTION_VIEW); Uri uri = Uri.parse("@drawable/sample_1.jpg"); intent.setData(uri); startActivity(intent); 问题是, Uri uri = Uri.parse("@drawable/sample_1.jpg"); 是不正确的。

将Uri转换为string

是否有可能将Uri转换为string,反之亦然? 因为我想把Uri转换成String来通过intent.putextra传递给另一个activity …或者如果不可能的话,谁能告诉我如何将选定的Uri传递给另一个activity? 谢谢

从URL获取主机域?

如何从一个stringURL获得主机域? GetDomain有1个input“URL”,1个输出“域” 例1 INPUT: http://support.domain.com/default.aspx?id=12345 OUTPUT: support.domain.com 例题 INPUT: http://www.domain.com/default.aspx?id=12345 OUTPUT: www.domain.com 示例3 INPUT: http://localhost/default.aspx?id=12345 OUTPUT: localhost

何时使用查询参数与matrix参数?

查询参数 : http://example.com/apples?order=random&color=blue : http://example.com/apples?order=random&color=blue matrix参数 : http://example.com/apples;order=random;color=blue : http://example.com/apples;order=random;color=blue 什么时候应该使用查询参数与matrix参数? 为什么matrix参数可以在URL的中间使用,但查询参数不能? 例如: http://example.com/apples;order=random;color=blue/2006/archive : http://example.com/apples;order=random;color=blue/2006/archive 如果matrix参数是查询参数的超集,为什么不一直使用它们? 你可以在这里阅读更多关于matrix参数: http : //www.w3.org/DesignIssues/MatrixURIs.html