本文整理汇总了Java中oauth.signpost.exception.OAuthException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java OAuthException.printStackTrace方法的具体用法?Java OAuthException.printStackTrace怎么用?Java OAuthException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oauth.signpost.exception.OAuthException
的用法示例。
在下文中一共展示了OAuthException.printStackTrace方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAccessTokenSet
import oauth.signpost.exception.OAuthException; //导入方法依赖的package包/类
/**
* Get access token-secret pair
*
* @param verifier OAuth verifier, which was got after authorization
* @return Access token-secret pair
* */
public HashMap<String, String> getAccessTokenSet(String verifier) {
try {
mOAuthProvider.retrieveAccessToken(mOAuthConsumer, verifier);
}
catch (OAuthException e) {
e.printStackTrace();
}
return setTokenWithSecret(mOAuthConsumer.getToken(), mOAuthConsumer.getTokenSecret());
}
示例2: _getAuthorizationUrl
import oauth.signpost.exception.OAuthException; //导入方法依赖的package包/类
/**
* Get authorization URL, use provided callback URL
*
* @param oauthCallback URL, i.e. oauth_callback
* @return URL for authorizing application
* */
private String _getAuthorizationUrl(String oauthCallback) {
String url = null;
try {
url = mOAuthProvider.retrieveRequestToken(mOAuthConsumer, oauthCallback);
}
catch (OAuthException e) {
e.printStackTrace();
}
return url;
}
示例3: getOAuthURL
import oauth.signpost.exception.OAuthException; //导入方法依赖的package包/类
public String getOAuthURL() {
try {
String auth = mOAuthProvider.retrieveRequestToken(mOAuthConsumer, "oauth://discogs");
return auth;
} catch (OAuthException e) {
e.printStackTrace();
}
return null;
}
示例4: setAccessToken
import oauth.signpost.exception.OAuthException; //导入方法依赖的package包/类
public void setAccessToken(String verifier) {
try {
if(verifier!=null) {
mOAuthProvider.retrieveAccessToken(mOAuthConsumer, verifier);
setSession(mOAuthConsumer.getToken(), mOAuthConsumer.getTokenSecret());
}
} catch (OAuthException e) {
e.printStackTrace();
}
}
示例5: sendPostRequest
import oauth.signpost.exception.OAuthException; //导入方法依赖的package包/类
/**
* Send signed POST OAuth request
*
* @param url Relative URL
* @param type Type of HTTP request (HTTP method)
* @param params Hash of parameters
* @throws JSONException If JSON object is invalid or request was abnormal
* @return {@link JSONObject} JSON Object that contains data from response
* */
private JSONObject sendPostRequest(String url, Integer type, HashMap<String, String> params) throws JSONException {
String fullUrl = getFullUrl(url);
HttpPost request = new HttpPost(fullUrl);
switch(type) {
case METHOD_PUT:
case METHOD_DELETE:
// assign overload value
String oValue;
if (type == METHOD_PUT) {
oValue = "put";
} else {
oValue = "delete";
}
params.put(OVERLOAD_PARAM, oValue);
case METHOD_POST:
break;
default:
throw new RuntimeException("Wrong http method requested");
}
// doing post request using json to avoid issue with urlencoded symbols
JSONObject json = new JSONObject();
for (Map.Entry<String, String> entry : params.entrySet()) {
json.put(entry.getKey(), entry.getValue());
}
request.setHeader("Content-Type", "application/json");
try {
request.setEntity(new StringEntity(json.toString()));
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// sign request
try {
mOAuthConsumer.sign(request);
}
catch (OAuthException e) {
e.printStackTrace();
}
return UpworkRestClient.getJSONObject(request, type, params);
}
示例6: sendPostRequest
import oauth.signpost.exception.OAuthException; //导入方法依赖的package包/类
/**
* Send signed POST OAuth request
*
* @param url Relative URL
* @param type Type of HTTP request (HTTP method)
* @param params Hash of parameters
* @throws JSONException If JSON object is invalid or request was abnormal
* @return {@link JSONObject} JSON Object that contains data from response
* */
private JSONObject sendPostRequest(String url, Integer type, HashMap<String, String> params) throws JSONException {
String fullUrl = getFullUrl(url);
HttpPost request = new HttpPost(fullUrl);
switch(type) {
case METHOD_PUT:
case METHOD_DELETE:
// assign overload value
String oValue;
if (type == METHOD_PUT) {
oValue = "put";
} else {
oValue = "delete";
}
params.put(OVERLOAD_PARAM, oValue);
case METHOD_POST:
break;
default:
throw new RuntimeException("Wrong http method requested");
}
// doing post request using json to avoid issue with urlencoded symbols
JSONObject json = new JSONObject();
for (Map.Entry<String, String> entry : params.entrySet()) {
json.put(entry.getKey(), entry.getValue());
}
request.setHeader("Content-Type", "application/json");
try {
request.setEntity(new StringEntity(json.toString()));
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// sign request
try {
mOAuthConsumer.sign(request);
}
catch (OAuthException e) {
e.printStackTrace();
}
return oDeskRestClient.getJSONObject(request, type, params);
}