如何配置 java rome fetcher 以与代理和身份验证一起使用
我正在尝试使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
设置
http.proxyHost
和http.proxyPort
是目前在罗马使用 http 代理的唯一选项。Setting
http.proxyHost
andhttp.proxyPort
is the only option to use http proxy for Rome for the time being.因为 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.
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.