问题描述
我目前正在使用Twitter4j来连接到Twitter API.与任何企业一样,请求必须通过代理服务器进行路由,并且我能够借助代理身份验证器以常规方式处理代理服务器.我在Twitter上配置了我的应用程序,并获得了我的用户密钥和机密.我可以使用此设置成功更新Twitter中的状态.
I am currently working on Twitter4j for connecting to Twitter API. As with any enterprise the request has to be routed through a proxy server and I was able to do the regular way of working around the proxy server with the help of a proxy authenticator. I configured my app in Twitter and got my consumer key and secret. I am able to successfully update status in Twitter using this setup.
从Java类的技术角度来看
From a technical Java classes standpoint I have
1)index.html2)login.java(用于获取OAuth请求和访问令牌并将URL重定向到回调的Servlet)3)Callback.java,用于更新Twitter中的推文
1) index.html2) login.java (Servlet for getting OAuth request and access tokens and redirecting the URL to the callback)3) Callback.java which updates the tweet in Twitter
迎接挑战
1)现在有一个新要求,即对Twitter的请求必须通过HTTPClient.我不知道如何得到这个.我知道如何使用HTTPClient,但通过通过它发送代理凭据来使用HTTPClient.甚至有可能吗?
1) Now there is a new requirement that the request to the twitter be through HTTPClient.I am unable to figure out how to get this. I know how to use HTTPClient but using the HTTPClient by sending the proxy credentials through it. Is it even possible?
2)我尝试使用ConfigurationBuilder,Congfiguration(假定在Twitter4j中),但是文档不好.
2) I tried to use the ConfigurationBuilder, Congfiguration (supposed to be in Twitter4j)but the documentation is not good.
有人可以将我引导到一些示例/URL吗?
Can someone please direct me to some example/URL ?
谢谢
推荐答案
1)根据此Twitter4j 2.1.4中将提供使用Apache HttpClient时的JIRA问题代理支持.
2)也许 JUnit测试会有所帮助吗?我不熟悉API,但单元测试有时可以提供有关API使用情况的线索,以代替良好的示例.
2) Perhaps the JUnit test could be helpful? I'm not familiar with the API but unit tests can sometimes provide a clue about API usage in lieu of good examples.
这篇关于Twitter4j HTTPClient ProxyServer和Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!