Twitter4j HTTPClient ProxyServer and Java

只愿长相守 提交于 2019-12-12 01:44:07

问题


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.

From a technical Java classes standpoint I have

1) index.html 2) 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

Coming to the challenges

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) I tried to use the ConfigurationBuilder, Congfiguration (supposed to be in Twitter4j)but the documentation is not good.

Can someone please direct me to some example/URL ?

Thanks


回答1:


1) According to this JIRA issue proxy support when using Apache HttpClient will be available in Twitter4j 2.1.4.

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.



来源:https://stackoverflow.com/questions/3518348/twitter4j-httpclient-proxyserver-and-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!