Tag: URL 方案

安全使用HttpURLConnection

当使用HttpURLConnection时,InputStream需要closures,如果我们不'得到'并使用它? 即这是安全的吗? HttpURLConnection conn = (HttpURLConnection) uri.getURI().toURL().openConnection(); conn.connect(); // check for content type I don't care about if (conn.getContentType.equals("image/gif") return; // get stream and read from it InputStream is = conn.getInputStream(); try { // read from is } finally { is.close(); } 其次, 在完全读取所有内容之前closuresInputStream是否安全? 是否存在将底层套接字置于ESTABLISHED或CLOSE_WAIT状态的风险?

如何在Global.aspx的Application_Start中获取完整的主机名和端口号?

我试过了 Uri uri = HttpContext.Current.Request.Url; String host = uri.Scheme + Uri.SchemeDelimiter + uri.Host + ":" + uri.Port; 它在我的本地机器上运行良好,但是在发布到IIS7时,有一个例外情况 System.Web.HttpException: Request is not available in this context 任何人都知道如何做到这一点?

parsing一个相对的urlpath到它的绝对path

Python中是否有这样的库? >>> resolvePath("http://www.asite.com/folder/currentpage.html", "anotherpage.html") 'http://www.asite.com/folder/anotherpage.html' >>> resolvePath("http://www.asite.com/folder/currentpage.html", "folder2/anotherpage.html") 'http://www.asite.com/folder/folder2/anotherpage.html' >>> resolvePath("http://www.asite.com/folder/currentpage.html", "/folder3/anotherpage.html") 'http://www.asite.com/folder3/anotherpage.html' >>> resolvePath("http://www.asite.com/folder/currentpage.html", "../finalpage.html") 'http://www.asite.com/finalpage.html'

打电话给操作系统打开url?

我可以使用什么来调用操作系统在用户默认的浏览器中打开一个URL? 不担心跨OS兼容性; 如果它在linux下工作对我来说足够了!

如何使用PHP获取以前的url

假设我的网站的url是在互联网上的某个页面上的超链接; 该网页可能是互联网上的任何东西 – 博客,orkut,雅虎,甚至stackoverflow等,有人点击它,并访问我的网站。 那么,我们可以知道,使用PHP,访客来到我的网页的前一个url?

如何在Android上显示来自URL的图片

我想在屏幕上显示图像。 图片应该来自URL,而不是可绘制的。 代码在这里: <ImageView android:id="@+id/ImageView01" android:src = "http://l.yimg.com/a/i/us/we/52/21.gif" android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView> 但是在编译时会出错。 如何在Android中显示来自url的图片?

NameValueCollection URL查询?

我知道我可以做到这一点 var nv = HttpUtility.ParseQueryString(req.RawUrl); 但有没有办法将其转换回url? var newUrl = HttpUtility.Something("/page", nv);

什么是Gmail的URL中的“shva”?

Gmailurl的以下部分是什么? https://mail.google.com/mail/?**zx**=1efobg68r40co&**shva**=1#inbox 如果你改变它,没有任何反应! 我知道Gmail不是一个开放源代码程序,所以我们不能追踪代码。 但是每个网站都会尽量缩短url,因此理想情况下不应该在url中添加冗余数据。 同时,如果他们改变,他们也没有什么区别,也没有错误。 编辑:我知道这是一个脚本语言的参数,因为我是一个PHP开发人员,但作为开发人员,我不会添加一个无用的参数,我认为这是显而易见的/原始的意义!

如何通过图像typesbutton在HTML表单中提交x和y?

我在我的申请表中创build了一个表单,如下所示: <form action="/search/" method="get"> <input id="search-box" name="search" type="text" size=30 title="Search" value="" /> <input id="search-submit" type="image" alt="Search" src="http://img.dovov.comsearch-button.gif" /> </form> 但是当我提交我的表单时,URL被创build如下: mysitename.com/search/?search=hello&x=0&y=0 任何人都可以告诉我为什么这个x和y来到我的url。 更多的事情,而不是图像button,如果我改变我的表单代码如下,那么它的工作正常, <form action="/search/" method="get"> <input id="search-box" name="search" type="text" size=30 title="Search" value="" /> <input id="search-submit" type="submit" value="Search"/> </form> 但我需要一个图像button,使我的表单看起来不错。 请告诉我如何从URL中删除这些x和y参数。

如何编码URL参数?

我正在尝试将parameter passing给一个如下所示的URL: http://www.foobar.com/foo?imageurl= 我想传递由另一个API自己生成的参数和图像的URL,图像的链接是: http://www.image.com/?username=unknown&password=unknown 但是,当我尝试使用URL时: http://www.foobar.com/foo?imageurl=http://www.image.com/?username=unknown&password=unknown 它不工作.. 我也尝试在imageURL上使用encodeURI和encodeURIComponents,并且这也不起作用。