當前位置: 首頁>>代碼示例>>Java>>正文


Java OAuthSignatureCalculator類代碼示例

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

}
 
開發者ID:eshioji,項目名稱:toy-java8,代碼行數:30,代碼來源:TwitterStreamFactory.java


注:本文中的com.ning.http.client.oauth.OAuthSignatureCalculator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。