Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在哪里可以下载org.springframework.http.client.AbstractBufferingClientHttpRequest.jar_Java_Twitter - Fatal编程技术网

Java 在哪里可以下载org.springframework.http.client.AbstractBufferingClientHttpRequest.jar

Java 在哪里可以下载org.springframework.http.client.AbstractBufferingClientHttpRequest.jar,java,twitter,Java,Twitter,我正在尝试运行一个简单的应用程序,连接到Twitter并提取时间线,但我在基本方面失败了。我正在使用Spring Social来实现这一点,文档中说这段代码应该可以用于创建连接: TwitterConnectionFactory connectionFactory=新的TwitterConnectionFactory(“consumerKey”、“ConsumerCret”); OAuth1Operations OAuth1Operations=connectionFactory.getOAut

我正在尝试运行一个简单的应用程序,连接到Twitter并提取时间线,但我在基本方面失败了。我正在使用Spring Social来实现这一点,文档中说这段代码应该可以用于创建连接:

TwitterConnectionFactory connectionFactory=新的TwitterConnectionFactory(“consumerKey”、“ConsumerCret”);
OAuth1Operations OAuth1Operations=connectionFactory.getOAuth1Operations();
String requestToken=oauth1Operations.fetchRequestToken(“回调URL”);
字符串authorizeUrl=oauth1Operations.buildAuthorizeUrl(requestToken,OAuth1Parameters.NONE);
sendRedirect(authorizeUrl);
//使用oauth_令牌和oauth_验证器参数接收提供程序回调时:
OAuthToken accessToken=oauth1Operations.exchangeForAccessToken(新的AuthorizedRequestToken(OAuthToken,oauthVerifier));
连接=connectionFactory.createConnection(accessToken);

然而,当我在debug中运行它时,当它到达第三行时,它抛出一个类“AbstractBufferingClientHttpRequest”not found异常。我已经包括了“org.springframework.http.client.AbstractClientHttpRequest.class”,但我需要一个带有额外“缓冲”字的,我在任何地方都找不到。请帮忙。

我会跳过使用
Connect
框架,直接实例化
TwitterApi
。保持生活简单,特别是当你只对检索时间线感兴趣时

public void GetMyTimeline()
{
  TwitterApi twitterApi = new TwitterApi(
    consumer_key, consumer_secret, access_token, access_token_secret);

  TwitterProfile myProfile = twitterApi.userOperations().getUserProfile();

  System.out.printf("Id: %s, Name: %s, ScreeName: %s\n",
    profile.getId(), profile.getName(), profile.getScreenName());

  List<Tweet> tweets = twitterApi.timelineOperations().getPublicTimeline();
  // Iterate over tweets List for the 20 most recent public tweets.

  // Do other API calls here...
}
public void GetMyTimeline()
{
TwitterApi TwitterApi=新TwitterApi(
消费者密钥、消费者密钥、访问令牌、访问令牌密钥);
TwitterProfile myProfile=twitterApi.userOperations().getUserProfile();
System.out.printf(“Id:%s,名称:%s,屏幕名称:%s\n”,
profile.getId()、profile.getName()、profile.getScreenName());
列出tweets=twitterApi.timelineOperations().getPublicTimeline();
//在tweets列表上迭代最近20条公共tweets。
//在这里执行其他API调用。。。
}
为使项目正确编译和运行而导入到项目中的JAR文件的长列表:


看起来该类在spring的发行版中可用。您可以在这里阅读如何使用maven/ivy获取与此相关的工件。

那么什么是连接框架,如果我所做的只是公共推特检索,为什么我需要消费者密钥和密钥以及访问令牌呢?
TwitterApi
类使用
connect
框架,它应该更易于使用,因为它负责为您设置
Connect
代码。您必须进行身份验证才能检索时间线,这就是为什么需要使用者密钥、使用者机密、访问令牌和令牌机密。使用
Search
api不需要进行身份验证,但这是针对“当前趋势”、“每日趋势”和查询搜索的。我不经常使用Twitter,所以希望这些都能在一定程度上有所帮助。:)