本文整理汇总了Java中com.ning.http.client.oauth.OAuthSignatureCalculator类的典型用法代码示例。如果您正苦于以下问题:Java OAuthSignatureCalculator类的具体用法?Java OAuthSignatureCalculator怎么用?Java OAuthSignatureCalculator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OAuthSignatureCalculator类属于com.ning.http.client.oauth包,在下文中一共展示了OAuthSignatureCalculator类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TwitterStreamFactory
import com.ning.http.client.oauth.OAuthSignatureCalculator; //导入依赖的package包/类
@Inject
public TwitterStreamFactory(
@Named("tw.consumer.key") String cKey,
@Named("tw.consumer.secret") String cSecret,
@Named("tw.request.token") String rToken,
@Named("tw.request.secret") String rSecret,
@Named("tw.stream.connection.timeout.ms") int connTimeout,
@Named("tw.stream.request.timeout.ms") int reqTimeout,
@Named("tw.stream.buffer.size") int bufferSize
){
AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder()
.setConnectionTimeoutInMs(connTimeout)
.setRequestTimeoutInMs(reqTimeout)
.setCompressionEnabled(true).build();
AsyncHttpClient client = new AsyncHttpClient(config);
ConsumerKey consumerKey = new ConsumerKey(cKey, cSecret);
RequestToken token = new RequestToken(rToken, rSecret);
OAuthSignatureCalculator calc = new OAuthSignatureCalculator(consumerKey, token);
client.setSignatureCalculator(calc);
this.httpClient = client;
this.watcher = MoreExecutors.getExitingExecutorService(ConcurrentUtils.namedExecutor("watcher", 1, 1));
this.bufferSize = bufferSize;
}