Package twitter4j

Examples of twitter4j.TwitterFactory


    public static Twitter newTwitter() {
        return new TwitterFactory().getOAuthAuthorizedInstance(CONSUMER_KEY, CONSUMER_SECRET);
    }

    public static Twitter newTwitter(AccessToken accessToken) {
        return new TwitterFactory().getOAuthAuthorizedInstance(CONSUMER_KEY, CONSUMER_SECRET, accessToken);
    }
View Full Code Here


        this.filterOld = filterOld;
    }

    public Twitter getTwitter() {
        if (twitter == null) {
            twitter = new TwitterFactory(getConfiguration()).getInstance();
        }
        return twitter;
    }
View Full Code Here

                .setOAuthConsumerKey(cred.getConsumerKey())
                .setOAuthConsumerSecret(cred.getConsumerSecret())
                .setOAuthAccessToken(cred.getAccessToken())
                .setOAuthAccessTokenSecret(cred.getTokenSecret());

        TwitterFactory tf = new TwitterFactory(cb.build());
        Twitter twitter = tf.getInstance();

        List<Status> statuses = twitter.getHomeTimeline();

        System.out.println("Showing friends timeline.");
        for (Status status : statuses) {
View Full Code Here

                .setOAuthAccessToken(cred.getAccessToken())
                .setOAuthAccessTokenSecret(cred.getTokenSecret());

        Configuration conf = cb.build();

        TwitterFactory tf = new TwitterFactory(conf);
        twitter = tf.getInstance();

        streamFactory = new TwitterStreamFactory(conf);

        rateLimiter = new Twitter4jRateLimiter();
    }
View Full Code Here

public class SigninServlet extends HttpServlet {
    private static final long serialVersionUID = -6205814293093350242L;

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Twitter twitter = new TwitterFactory().getInstance();
        request.getSession().setAttribute("twitter", twitter);
        try {
            StringBuffer callbackURL = request.getRequestURL();
            int index = callbackURL.lastIndexOf("/");
            callbackURL.replace(index, callbackURL.length(), "").append("/callback");
View Full Code Here

 
  // Afegeix un tweet
  public static void updateWhatAreYouDoing(String latestStatus)
  {
    // The factory instance is re-useable and thread safe.
      twitter = new TwitterFactory().getInstance();
      Status status;
    try {
      status = twitter.updateStatus(latestStatus);
      System.out.println("Successfully updated the status to [" + status.getText() + "].");
    } catch (TwitterException e) {
View Full Code Here

 
 
  public static void getPublicTimeline()
  {
     // The factory instance is re-useable and thread safe.
      twitter = new TwitterFactory().getInstance();
      List<Status> statuses = null;
    try {
      statuses = twitter.getPublicTimeline();
    } catch (TwitterException e) {
      // TODO Auto-generated catch block
View Full Code Here

 
 
  public static void getTimelineFriends()
  {
     // The factory instance is re-useable and thread safe.
      twitter = new TwitterFactory().getInstance();
      List<Status> statuses = null;
    try {
      statuses = twitter.getFriendsTimeline();
    } catch (TwitterException e) {
      // TODO Auto-generated catch block
View Full Code Here

 
  public void sendReceiveMessages(String recipientId, String text)
  {
   
     // The factory instance is re-useable and thread safe.
      Twitter sender = new TwitterFactory().getInstance();
      DirectMessage message;
    try {
      message = sender.sendDirectMessage(recipientId, text);
      System.out.println("Sent: " + message.getText() + " to @" + message.getRecipientScreenName());
    } catch (TwitterException e) {
View Full Code Here

 
  public static void searchTweets()
  {
      // The factory instance is re-useable and thread safe.
      twitter = new TwitterFactory().getInstance();
     
      Query query = new Query("CLOUD JBOSS");
      QueryResult result;
    try {
      result = twitter.search(query);
View Full Code Here

TOP

Related Classes of twitter4j.TwitterFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.