This example demonstrates how to develop a simple web app client utilizing Jersey client API and Jersey OAuth support.
This example consists of the main class (App
) and two JAXB beans
used for unmarshaling the responses from Twitter (Status
and User
).
Before running the example, you have to register your own application with Twitter (to obtain consumer key and consumer secret you have to use to configure this client). You can do it as follows:
Enter the following on the command-line:
mvn clean compile exec:java -DforkMode=never -DconsumerKey=<consumer key assigned to your app> -DconsumerSecret=<consumer secret assigned to your app>
After you run the application for the first time, it stores the consumer key, secret and token and token secret in a property file for future use. So, for subsequent runs you don't have to specify these as system properties. The following command is good enough for running the application after it was built, run for the first time and the property file was created:
mvn exec:java
Behind a HTTP proxy, you will need to setup the following system properties to communicate with the Twitter server: