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


Java ApiException类代码示例

本文整理汇总了Java中org.springframework.social.ApiException的典型用法代码示例。如果您正苦于以下问题:Java ApiException类的具体用法?Java ApiException怎么用?Java ApiException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: retreiveSocialAsUser

import org.springframework.social.ApiException; //导入依赖的package包/类
private User retreiveSocialAsUser(Connection<?> con) {
    if (con == null) throw new IllegalStateException("No connection to social api");

    // build a new User from the external provider's version of the User
    UserProfile profile = con.fetchUserProfile();
    String firstName = profile.getFirstName();
    String lastName = profile.getLastName();
    String email = profile.getEmail();

    // build the UserAccountExternal from the ConnectionKey
    String externalAccountProviderName = con.getKey().getProviderId();
    ExternalProvider externalProvider = ExternalProvider.caseInsensitiveValueOf(externalAccountProviderName);
    String externalUserId = con.getKey().getProviderUserId();

    // check that we got the information we needed
    if (StringUtils.isBlank(email))
        throw new ApiException(externalAccountProviderName, "provider failed to return email");

    User socialUser = new User(firstName, lastName, email, externalProvider, externalUserId);

    log.debug("Retrieved details from {} for user '{}'", externalAccountProviderName, externalUserId);
    return socialUser;
}
 
开发者ID:esutoniagodesu,项目名称:egd-web,代码行数:24,代码来源:SocialConnectionSignUp.java

示例2: getDocsService

import org.springframework.social.ApiException; //导入依赖的package包/类
private DocsService getDocsService(Connection<GoogleDocs> connection)
{
    DocsService docsService = null;

    try
    {
        docsService = connection.getApi().setAuthentication(new DocsService(GoogleDocsConstants.APPLICATION_NAME));
    }
    catch (ApiException apie)
    {
        throw apie;
    }

    log.debug("Google Docs Client initiated");
    return docsService;

}
 
开发者ID:Pluies,项目名称:Alfresco-Google-docs-plugin,代码行数:18,代码来源:GoogleDocsServiceImpl.java

示例3: test

import org.springframework.social.ApiException; //导入依赖的package包/类
@Override
public boolean test(Twitter twitter) {
    try {
        twitter.userOperations().getUserProfile();
        return true;
    } catch (ApiException e) {
        log.error("Error during twitter API test", e);
        return false;
    }
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:11,代码来源:TwitterAdapter.java

示例4: setConnectionValues

import org.springframework.social.ApiException; //导入依赖的package包/类
@Override
public void setConnectionValues(GitlabAPI gitlab, ConnectionValues values) {

    try {
        GitlabUser gitlabUser = gitlab.getUser();
        values.setProviderUserId(Long.toString(gitlabUser.getId()));
        values.setDisplayName(gitlabUser.getUsername());
        values.setImageUrl(gitlabUser.getAvatarUrl());
    } catch (IOException e) {
        throw new ApiException("gitlab?", "Could not fetch current user.", e);
    }
}
 
开发者ID:burning-duck,项目名称:spring-social-gitlab,代码行数:13,代码来源:GitlabAdapter.java

示例5: fetchUserProfile

import org.springframework.social.ApiException; //导入依赖的package包/类
@Override
public UserProfile fetchUserProfile(GitlabAPI gitlab) {
    try {
        GitlabUser gitlabUser = gitlab.getUser();

        return new UserProfileBuilder()
                .setEmail(gitlabUser.getEmail())
                .setName(gitlabUser.getName())
                .setUsername(gitlabUser.getUsername())
                .build();
    } catch (IOException e) {
        throw new ApiException("gitlab?", "Could not fetch current user.", e);
    }
}
 
开发者ID:burning-duck,项目名称:spring-social-gitlab,代码行数:15,代码来源:GitlabAdapter.java

示例6: test

import org.springframework.social.ApiException; //导入依赖的package包/类
@Override
public boolean test(Yahoo2 yahoo) {
	try {
		return true;
	} catch (ApiException e) {
		return false;
	}
}
 
开发者ID:alex-bretet,项目名称:cloudstreetmarket.com,代码行数:9,代码来源:YahooOAuth2Adapter.java

示例7: test

import org.springframework.social.ApiException; //导入依赖的package包/类
@Override
public boolean test(Kakao kakao) {
    try {
        kakao.userOperations().isStoryUser();
        return true;
    } catch (ApiException e) {
        return false;
    }
}
 
开发者ID:Hongchae,项目名称:spring-social-kakao,代码行数:10,代码来源:KakaoAdaptor.java

示例8: test

import org.springframework.social.ApiException; //导入依赖的package包/类
@Override
public boolean test(KeyRock keyRock) {
	boolean res = false;
	try {
		keyRock.userOperations().getUserProfile();
		res = true;
	} catch (ApiException e) {
	}
	return res;
}
 
开发者ID:TribalyteTechnologies,项目名称:spring-social-fiware-lab,代码行数:11,代码来源:KeyRockAdapter.java

示例9: test

import org.springframework.social.ApiException; //导入依赖的package包/类
public boolean test(Flickr flickr)
{
    try
    {
        flickr.test();
        return true;
    }
    catch (ApiException e)
    {
        return false;
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:13,代码来源:FlickrAdapter.java

示例10: test

import org.springframework.social.ApiException; //导入依赖的package包/类
public boolean test(TencentWeibo tencentWeibo) {
    try {
        return true;
    } catch (ApiException e) {
        return false;
    }
}
 
开发者ID:avidoggy,项目名称:spring-social-tencent-weibo,代码行数:8,代码来源:TencentWeiboAdapter.java

示例11: test

import org.springframework.social.ApiException; //导入依赖的package包/类
@Override
public boolean test(Battlenet api) {
    try {
        api.accountOperations().getAccountId();
        return true;
    } catch (ApiException apiException) {
        return false;
    }
}
 
开发者ID:saladinkzn,项目名称:spring-social-battlenet,代码行数:10,代码来源:BattlenetAdapter.java

示例12: test

import org.springframework.social.ApiException; //导入依赖的package包/类
public boolean test(Reddit reddit) {
	try {
		reddit.userOperations().getUserProfile();
		return true;
	} catch (ApiException e) {
		return false;
	}
}
 
开发者ID:alyahmed,项目名称:spring-social-reddit,代码行数:9,代码来源:RedditAdapter.java

示例13: test

import org.springframework.social.ApiException; //导入依赖的package包/类
@Override
public boolean test(Meetup meetup) {
	try {
		meetup.memberOperations().getDetails();
		return true;
	} catch(ApiException ex) {
		return false;
	}
}
 
开发者ID:yarli4u,项目名称:spring-social-meetup,代码行数:10,代码来源:MeetupAdapter.java

示例14: postConnect

import org.springframework.social.ApiException; //导入依赖的package包/类
public void postConnect(Connection<Facebook> connection, WebRequest request) {
	if (request.getAttribute(POST_TO_WALL_ATTRIBUTE, WebRequest.SCOPE_SESSION) != null) {
		try {
			connection.updateStatus("I've connected with the Spring Social Showcase!");
		} catch (ApiException e) {
			// Do nothing: No need to break down if the post-connect post can't be made.
		}
		request.removeAttribute(POST_TO_WALL_ATTRIBUTE, WebRequest.SCOPE_SESSION);
	}
}
 
开发者ID:joshlong,项目名称:javaconfig-ftw,代码行数:11,代码来源:PostToWallAfterConnectInterceptor.java

示例15: test

import org.springframework.social.ApiException; //导入依赖的package包/类
@Override
public boolean test(Box api) {
    try {
        api.userOperations().getUserProfile();
        return true;
    } catch (ApiException e) {
        return false;
    }
}
 
开发者ID:eSignLive,项目名称:spring-social-box,代码行数:10,代码来源:BoxAdapter.java


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