限制“rundll32 url.dll,FileProtocolHandler”的URL长度? [英] Limit for URL length for "rundll32 url.dll,FileProtocolHandler"?

查看:215
本文介绍了限制“rundll32 url.dll,FileProtocolHandler”的URL长度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很长的URL,我想在Windows系统上使用Java从默认浏览器中打开大量参数

I have a long URL with tons of parameters that I want to open in the default browser from Java on a Windows system using

Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler "+url)

对于 http://www.google.com 这样的简短网址,此功能正常。但对于长URL(例如,2000个字符),这根本不做任何事情:没有异常或任何类型,它只是被忽略。

For short URLs like "http://www.google.com" this works fine. But for long URLs (say, 2000 characters), this simply does absolutely nothing at all: no exception or anything of the sort, it is simply ignored.

是否有字符限制a)对于Runtime.exec命令或b)对于rundll32 url.dll命令?如果是这样,那么限制是什么?

Is there a character limit a) for a Runtime.exec command or b) for the rundll32 url.dll command? If so, what is the limit?

推荐答案

你将遇到操作系统/浏览器特定的最大URL长度问题:

You will be running up against this operating system/browser specific maximum URL length problem:

For rundll32 url.dll(即Microsoft IE)你将被限制在2,083个字符(包括http://)。

For "rundll32 url.dll" (i.e. Microsoft IE) you will be limited to 2,083 characters (including http://).

从我坐的地方你有两个选择:

From where I sit you have two alternatives:


  1. 构建(或使用)TinyURL风格的服务
    ,将您的长网址转换为
    简短的,重定向的。然而,即使是
    ,你也会遇到
    相同的URL长度问题,只需在浏览器本身的
    内,而不是你的
    Runtime()语句。例如浏览器窗口将打开,转到短URL,该URL将执行重定向到长URL并失败。

  1. Build (or use) a TinyURL-style service that turns your long-urls into short, redirected ones. However even here you are going to run into the same URL length issue, just within the browser itself rather than your Runtime() statement. e.g. The browser window would open, go to the short-URL which would perform the redirect to the long-URL and fail.

使用POST请求并将
中的所有网址参数埋藏一些或
。而不是使用GET调用,
可以在HTTP POST请求的主体内提供非常长的参数
。这个
不会像示例代码那么简单。事实上,使用rundll32 url.dll组合可能相当棘手(或不可能)(我不熟悉)......

Use a POST request and bury some or all of your URL parameters within it. Rather than using a GET call you can supply very long parameters within the body of an HTTP POST request. This would not be as simple as your example code. In fact this maybe quite tricky (or impossible) with the rundll32 url.dll combination (I am not familiar with it)...

这篇关于限制“rundll32 url.dll,FileProtocolHandler”的URL长度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆