Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.belladati.sdk.impl;
 
 import java.net.URL;
 import java.util.List;
 
The serialVersionUID
	private static final long serialVersionUID = -4137207765985769374L;
	private final BellaDatiClient client;
	BellaDatiConnectionImpl(String baseUrlboolean trustSelfSigned) {
		 = new BellaDatiClient(baseUrltrustSelfSigned);
	}
	public OAuthRequest oAuth(String consumerKeyString consumerSecret) {
		return oAuth(consumerKeyconsumerSecretnull);
	}
	public OAuthRequest oAuth(String consumerKeyString consumerSecretString redirectUrlthrows ConnectionException,
		HttpParameters params = new HttpParameters();
		if (redirectUrl != null) {
			// check if the redirect URL is valid
			try {
				new URL(redirectUrl);
				params.put(., OAuth.percentEncode(redirectUrl));
catch (MalformedURLException e) {
				throw new IllegalArgumentException("Invalid redirect URL"e);
			}
		}
		TokenHolder tokenHolder = new TokenHolder(consumerKeyconsumerSecret);
		.postToken("oauth/requestToken"tokenHolderparams);
		return new OAuthRequestImpl(tokenHolder);
	}
	public BellaDatiService xAuth(String consumerKeyString consumerSecretString usernameString password) {
		TokenHolder tokenHolder = new TokenHolder(consumerKeyconsumerSecret);
		List<? extends NameValuePairparameters = Arrays.asList(new BasicNameValuePair("x_auth_username"username),
			new BasicNameValuePair("x_auth_password"password));
		.postToken("oauth/accessToken"tokenHolderparameters);
		return new BellaDatiServiceImpl(tokenHolder);
	}
	public String toString() {
		return "Connection(server: " + .getBaseUrl() + ")";
	}
New to GrepCode? Check out our FAQ X