当前位置: 首页>>代码示例>>Java>>正文


Java OAuthAuthorization.setOAuthConsumer方法代码示例

本文整理汇总了Java中twitter4j.auth.OAuthAuthorization.setOAuthConsumer方法的典型用法代码示例。如果您正苦于以下问题:Java OAuthAuthorization.setOAuthConsumer方法的具体用法?Java OAuthAuthorization.setOAuthConsumer怎么用?Java OAuthAuthorization.setOAuthConsumer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twitter4j.auth.OAuthAuthorization的用法示例。


在下文中一共展示了OAuthAuthorization.setOAuthConsumer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setOAuthConsumer

import twitter4j.auth.OAuthAuthorization; //导入方法依赖的package包/类
@Override
public synchronized void setOAuthConsumer(String consumerKey, String consumerSecret) {
    if (null == consumerKey) {
        throw new NullPointerException("consumer key is null");
    }
    if (null == consumerSecret) {
        throw new NullPointerException("consumer secret is null");
    }
    if (auth instanceof NullAuthorization) {
        if (conf.isApplicationOnlyAuthEnabled()) {
            OAuth2Authorization oauth2 = new OAuth2Authorization(conf);
            oauth2.setOAuthConsumer(consumerKey, consumerSecret);
            auth = oauth2;
        } else {
            OAuthAuthorization oauth = new OAuthAuthorization(conf);
            oauth.setOAuthConsumer(consumerKey, consumerSecret);
            auth = oauth;
        }
    } else if (auth instanceof BasicAuthorization) {
        XAuthAuthorization xauth = new XAuthAuthorization((BasicAuthorization) auth);
        xauth.setOAuthConsumer(consumerKey, consumerSecret);
        auth = xauth;
    } else if (auth instanceof OAuthAuthorization || auth instanceof OAuth2Authorization) {
        throw new IllegalStateException("consumer key/secret pair already set.");
    }
}
 
开发者ID:DiscourseDB,项目名称:discoursedb-core,代码行数:27,代码来源:TwitterBaseImpl.java

示例2: getInstance

import twitter4j.auth.OAuthAuthorization; //导入方法依赖的package包/类
/**
 * Returns a OAuth Authenticated instance.<br>
 * consumer key and consumer Secret must be provided by twitter4j.properties, or system properties.<br>
 * Unlike {@link AsyncTwitter#setOAuthAccessToken(twitter4j.auth.AccessToken)}, this factory method potentially returns a cached instance.
 *
 * @param accessToken access token
 * @return an instance
 */
public AsyncTwitter getInstance(AccessToken accessToken) {
    String consumerKey = conf.getOAuthConsumerKey();
    String consumerSecret = conf.getOAuthConsumerSecret();
    if (null == consumerKey && null == consumerSecret) {
        throw new IllegalStateException("Consumer key and Consumer secret not supplied.");
    }
    OAuthAuthorization oauth = new OAuthAuthorization(conf);
    oauth.setOAuthConsumer(consumerKey, consumerSecret);
    oauth.setOAuthAccessToken(accessToken);
    return new AsyncTwitterImpl(conf, oauth);
}
 
开发者ID:SamKnows,项目名称:skandroid-core,代码行数:20,代码来源:AsyncTwitterFactory.java

示例3: getOAuthOuthorization

import twitter4j.auth.OAuthAuthorization; //导入方法依赖的package包/类
private OAuthAuthorization getOAuthOuthorization(Configuration conf) {
    OAuthAuthorization oauth = new OAuthAuthorization(conf);
    oauth.setOAuthConsumer(desktopConsumerKey, desktopConsumerSecret);
    oauth.setOAuthAccessToken(new AccessToken(id1.accessToken, id1.accessTokenSecret));
    return oauth;
}
 
开发者ID:SamKnows,项目名称:skandroid-core,代码行数:7,代码来源:DAOTest.java


注:本文中的twitter4j.auth.OAuthAuthorization.setOAuthConsumer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。