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


Java ConnectionException類代碼示例

本文整理匯總了Java中com.belladati.sdk.exception.ConnectionException的典型用法代碼示例。如果您正苦於以下問題:Java ConnectionException類的具體用法?Java ConnectionException怎麽用?Java ConnectionException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ConnectionException類屬於com.belladati.sdk.exception包,在下文中一共展示了ConnectionException類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: oAuth

import com.belladati.sdk.exception.ConnectionException; //導入依賴的package包/類
@Override
public OAuthRequest oAuth(String consumerKey, String consumerSecret, String redirectUrl) throws ConnectionException,
	AuthorizationException {
	HttpParameters params = new HttpParameters();
	if (redirectUrl != null) {
		// check if the redirect URL is valid
		try {
			new URL(redirectUrl);
			params.put(OAuth.OAUTH_CALLBACK, OAuth.percentEncode(redirectUrl));
		} catch (MalformedURLException e) {
			throw new IllegalArgumentException("Invalid redirect URL", e);
		}
	}
	TokenHolder tokenHolder = new TokenHolder(consumerKey, consumerSecret);

	client.postToken("oauth/requestToken", tokenHolder, params);
	return new OAuthRequestImpl(client, tokenHolder);
}
 
開發者ID:BellaDati,項目名稱:belladati-sdk-java,代碼行數:19,代碼來源:BellaDatiConnectionImpl.java

示例2: connectionFailed

import com.belladati.sdk.exception.ConnectionException; //導入依賴的package包/類
/** server is not available */
@Test(expectedExceptions = ConnectionException.class)
public void connectionFailed() throws Exception {
	getService();
	server.shutDown();
	getService().getClient().get(uri, getService().getTokenHolder());
}
 
開發者ID:BellaDati,項目名稱:belladati-sdk-java,代碼行數:8,代碼來源:ExceptionTest.java

示例3: connectionFailed

import com.belladati.sdk.exception.ConnectionException; //導入依賴的package包/類
/** server is not available */
@Test(expectedExceptions = ConnectionException.class)
public void connectionFailed() throws Exception {
	server.stop();
	service.client.get(uri, service.tokenHolder);
}
 
開發者ID:BellaDati,項目名稱:belladati-sdk-android,代碼行數:7,代碼來源:ExceptionTest.java

示例4: oAuth

import com.belladati.sdk.exception.ConnectionException; //導入依賴的package包/類
/**
 * Initiates OAuth authentication by requesting a request token from the
 * BellaDati server.
 * 
 * @param consumerKey the consumer key configured in your BellaDati domain
 * @param consumerSecret the consumer secret configured in your BellaDati
 *            domain
 * @return the ongoing OAuth authentication
 * @throws ConnectionException if connection to the server fails
 * @throws AuthorizationException if something went wrong during
 *             authentication, check
 *             {@link AuthorizationException#getReason()} for details
 */
OAuthRequest oAuth(String consumerKey, String consumerSecret) throws ConnectionException, AuthorizationException;
 
開發者ID:BellaDati,項目名稱:belladati-sdk-api,代碼行數:15,代碼來源:BellaDatiConnection.java

示例5: xAuth

import com.belladati.sdk.exception.ConnectionException; //導入依賴的package包/類
/**
 * Authenticates to the BellaDati server using xAuth. To use xAuth, it must
 * be enabled in your domain.
 * <p>
 * <b>Warning:</b> For security reasons, we recommend using OAuth for
 * authentication. Use xAuth only if it is not possible to use a web browser
 * for authentication in your workflow.
 * 
 * @param consumerKey the consumer key configured in your BellaDati domain
 * @param consumerSecret the consumer secret configured in your BellaDati
 *            domain
 * @param username username of the user logging in
 * @param password password of the user logging in
 * @return a service instance accessing BellaDati as the user with the given
 *         credentials
 * @throws ConnectionException if connection to the server fails
 * @throws AuthorizationException if something went wrong during
 *             authentication, check
 *             {@link AuthorizationException#getReason()} for details
 */
BellaDatiService xAuth(String consumerKey, String consumerSecret, String username, String password)
	throws ConnectionException, AuthorizationException;
 
開發者ID:BellaDati,項目名稱:belladati-sdk-api,代碼行數:23,代碼來源:BellaDatiConnection.java


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