如何配置 java rome fetcher 以与代理和身份验证一起使用

发布于 2024-12-12 08:38:18 字数 587 浏览 4 评论 0原文

我正在尝试使用 java rome-fetcher 获取 rss 提要进行处理。当我可以直接访问互联网时,一切正常。

但是,我需要能够在代理服务器后面运行我的应用程序。

我一直无法弄清楚如何使用 Rome-fetcher 来完成此操作。

我知道 jvm

System.setProperty("http.proxyHost", proxy); System.setProperty("http.proxyPort", proxyPort);

hack,但这不是一个选项,原因我不想解释。

使用 HttpClient,您通常会执行类似的操作。

DefaultHttpClient 客户端 = new DefaultHttpClient(); HttpHost proxyTarget = new HttpHost("proxy.server.com", 4444); client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxyTarget);

有人如何将代理设置和与此相关的身份验证凭据分配给 rome-fetcher 吗?

I'm trying to use java rome-fetcher to acquire rss feeds for processing. Everything works fine when I have direct internet access.

However, I need to be able to run my application behind a proxy server.

I have been unable to figure out how this can be done with rome-fetcher.

I am aware of the jvm

System.setProperty("http.proxyHost", proxy);
System.setProperty("http.proxyPort", proxyPort);

hack, but that is not an option for reasons I don't really want to explain.

With HttpClient you typically do something like this.

DefaultHttpClient client = new DefaultHttpClient();
HttpHost proxyTarget = new HttpHost("proxy.server.com", 4444);
client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxyTarget);

Does anyone how to assign proxy settings, and authentication credentials for that matter, to rome-fetcher?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

悲念泪 2024-12-19 08:38:18

设置 http.proxyHosthttp.proxyPort 是目前在罗马使用 http 代理的唯一选项。

Setting http.proxyHost and http.proxyPort is the only option to use http proxy for Rome for the time being.

迷鸟归林 2024-12-19 08:38:18

因为 System.setProperty(...) 是 rome-fetcher 的唯一代理选项,所以我最终下载了 rome-fetcher 源代码的副本,并对底层 http 客户端进行了修改,以便它可以处理不同的代理配置。

Because the System.setProperty(...) is the only proxy option for rome-fetcher I ended up downloading a copy of the rome-fetcher source and made modifications to the underlying http client so it can handle different proxy configurations.

半暖夏伤 2024-12-19 08:38:18

Fetcher 在 Rome 1.6 版本中已弃用,并将在 2.0 版本中删除:

https://github.com /rometools/rome/issues/276

给出的原因之一是用户无法完全控制底层 HTTP 连接——一个例子是无法指定代理。建议直接使用 Apache HttpClient。

Fetcher was deprecated in version 1.6 of Rome and will be removed in version 2.0:

https://github.com/rometools/rome/issues/276

One of the reasons given is that the user doesn't have full control over the underlying HTTP connection -- an example being the inability to specify a proxy. Directly using Apache HttpClient is suggested instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文