Package twitter4j

Examples of twitter4j.Twitter.updateStatus()


  public void execute(DelegateExecution execution) throws Exception {     
    String content = (String) execution.getVariable("content");
     
    AccessToken accessToken = new AccessToken("220324559-8hWDVUXMSOaAnmtNNwBuNuhGJ6hOGwNdWHqhdOsU", "sGBZafB7saWYMwnPQGjjwU9Ggr0IJYkmPdyAFU5PI");
    Twitter twitter = new TwitterFactory().getOAuthAuthorizedInstance("HW62M0Rxtt39CbgdgP1og", "TJHNqolmPD6aHPtX8ec5Xp5zgIJcsMBTkwMpGCqdGuk", accessToken);
    twitter.updateStatus(content);
  }

}
View Full Code Here


   */
  private void post(String twitterUrl, String twitterUsername,
      String twitterPassword, String msg) throws Exception {
    System.out.println("Posting to Twitter: " + msg);
    Twitter twitter = new Twitter(twitterUsername, twitterPassword, twitterUrl);
    twitter.updateStatus(msg);
  }


  /**
   * create a shortened version of the given url
View Full Code Here

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        String text = request.getParameter("text");
        Twitter twitter = (Twitter)request.getSession().getAttribute("twitter");
        try {
            twitter.updateStatus(text);
        } catch (TwitterException e) {
            throw new ServletException(e);
        }
        response.sendRedirect(request.getContextPath()+ "/");
    }
View Full Code Here

           
            //configuro a mensagem que seria enviada ao twitter
            String novoStatus = "@[" + twt + "] acabou de se cadastrar no site [http://stechtwitter.appspot.com/]";
           
            //envio o twitter
            twitter.updateStatus(novoStatus);
           
        //se o usuario nao digitou um twitter, recupera o nome dele da sessao   
          }else{
            String nome = (String)ActionContext.getContext().getSession().get("nome");
           
View Full Code Here

           
            //configuro a mensagem que seria enviada ao twitter com o nome do usuario
            String novoStatus = "[" + nome + "] acabou de se cadastrar no site [http://stechtwitter.appspot.com/]";
           
            //envio o twitter
            twitter.updateStatus(novoStatus);
          }   
      } catch (TwitterException ex) {
          return "ERROR";
      }
      return SUCCESS;
View Full Code Here

     * @throws TwitterException
     */
    public TweetPublishedMetadata updateTwitterStatus(final String tweet) throws TwitterException{
        log.debug("twitter update status 2--> "+tweet);
        final Twitter twitter = this.getTwitterInstance();
        final Status twitterStatus = twitter.updateStatus(tweet);
        log.debug("twitter update status "+twitterStatus);
        TweetPublishedMetadata status = createStatus(tweet);
        status.setTweetId(String.valueOf(twitterStatus.getId()));
        //statusTweet.set status.g
        status.setDatePublished(twitterStatus.getCreatedAt());
View Full Code Here

        twitter.setOAuthConsumer(
                settings.get("river.twitter.oauth.consumer_key"),
                settings.get("river.twitter.oauth.consumer_secret"));
        twitter.setOAuthAccessToken(accessToken);

        Status status = twitter.updateStatus("testing twitter river. Please ignore. " +
                        DateTime.now().toString());
        logger.info("  -> tweet [{}] sent: [{}]", status.getId(), status.getText());

        assertThat(awaitBusy(new Predicate<Object>() {
            public boolean apply(Object obj) {
View Full Code Here

        }
      }
    }
    // persist to the accessToken for future reference.
    storeAccessToken(twitter.verifyCredentials().getId(), accessToken);
    Status status = twitter.updateStatus(args[0]);
    System.out.println("Successfully updated the status to ["
        + status.getText() + "].");
    System.exit(0);
  }
View Full Code Here

                noticiaBC.insert(noticia);
           
            if (shareOnTwitter == true) {
                try {
                    Twitter twitter = TwitterUtil.getTwitter(TwitterUtil.convert(getSite()));
                    twitter.updateStatus("Notícia Postada: '" + noticia.getNtcTitulo() + "'. Acesse o site e confira.");
                } catch (TwitterException ex) {
                    messageContext.add("Erro ao Enviar para Twitter.", SeverityType.WARN);
                }
                shareOnTwitter = false;
            }
View Full Code Here

                mediaIds[i-1] = media.getMediaId();
            }
           
            StatusUpdate update = new StatusUpdate(args[0]);
            update.setMediaIds(mediaIds);
            Status status = twitter.updateStatus(update);
            System.out.println("Successfully updated the status to [" + status.getText() + "][" + status.getId() + "].");
            System.exit(0);
        } catch (TwitterException te) {
            te.printStackTrace();
            System.out.println("Failed to update status: " + te.getMessage());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.