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