views:

91

answers:

1

Hi there

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

A: 

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.

laz
OK. I figured out the solution for this. Basically Twitter4j implements HTTPClient internally. The way you do it is - First configure your ConfigurationBuilder object then you can create Configuration object out of it and pass this Config object to the Twitter4j service class (at the time of creating the Twitter object).
sv1