本文整理匯總了Java中org.scribe.model.OAuthRequest.addPayload方法的典型用法代碼示例。如果您正苦於以下問題:Java OAuthRequest.addPayload方法的具體用法?Java OAuthRequest.addPayload怎麽用?Java OAuthRequest.addPayload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.scribe.model.OAuthRequest
的用法示例。
在下文中一共展示了OAuthRequest.addPayload方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: post
import org.scribe.model.OAuthRequest; //導入方法依賴的package包/類
@Override
public String post(String url, byte[] payload, Map.Entry<String, String>... params) {
OAuthRequest request = new OAuthRequest(Verb.POST, url);
if (params != null) {
this.addBodyParams(request, params);
}
request.addPayload(payload);
request.addHeader("Content-Type", "application/json");
this.service.signRequest(this.accesToken, request);
Response r = request.send();
return r.getBody();
}
示例2: put
import org.scribe.model.OAuthRequest; //導入方法依賴的package包/類
@Override
public void put(String url, byte[] payload, Map.Entry<String, String>... params) {
OAuthRequest request = new OAuthRequest(Verb.PUT, url);
if (params != null) {
this.addBodyParams(request, params);
}
request.addPayload(payload);
request.addHeader("Content-Type", "application/json");
this.service.signRequest(this.accesToken, request);
Response r = request.send();
if (!(r.getCode() == 204)) {
throw new PutException("Invalid return code", r.getCode());
}
}