本文整理匯總了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;
}