本文整理汇总了Java中net.oauth.OAuth.percentEncode方法的典型用法代码示例。如果您正苦于以下问题:Java OAuth.percentEncode方法的具体用法?Java OAuth.percentEncode怎么用?Java OAuth.percentEncode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.oauth.OAuth
的用法示例。
在下文中一共展示了OAuth.percentEncode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBaseString
import net.oauth.OAuth; //导入方法依赖的package包/类
public static String getBaseString(OAuthMessage message)
throws IOException, URISyntaxException {
List<Map.Entry<String, String>> parameters;
String url = message.URL;
int q = url.indexOf('?');
if (q < 0) {
parameters = message.getParameters();
} else {
// Combine the URL query string with the other parameters:
parameters = new ArrayList<Map.Entry<String, String>>();
parameters.addAll(OAuth.decodeForm(message.URL.substring(q + 1)));
parameters.addAll(message.getParameters());
url = url.substring(0, q);
}
return OAuth.percentEncode(message.method.toUpperCase()) + '&'
+ OAuth.percentEncode(normalizeUrl(url)) + '&'
+ OAuth.percentEncode(normalizeParameters(parameters));
}
示例2: computeSignature
import net.oauth.OAuth; //导入方法依赖的package包/类
private byte[] computeSignature(String baseString)
throws GeneralSecurityException, UnsupportedEncodingException {
SecretKey key = null;
synchronized (this) {
if (this.key == null) {
String keyString = OAuth.percentEncode(getConsumerSecret())
+ '&' + OAuth.percentEncode(getTokenSecret());
byte[] keyBytes = keyString.getBytes(ENCODING);
this.key = new SecretKeySpec(keyBytes, MAC_NAME);
}
key = this.key;
}
Mac mac = Mac.getInstance(MAC_NAME);
mac.init(key);
byte[] text = baseString.getBytes(ENCODING);
return mac.doFinal(text);
}
示例3: ComparableParameter
import net.oauth.OAuth; //导入方法依赖的package包/类
ComparableParameter(Map.Entry value) {
this.value = value;
String n = toString(value.getKey());
String v = toString(value.getValue());
this.key = OAuth.percentEncode(n) + ' ' + OAuth.percentEncode(v);
// ' ' is used because it comes before any character
// that can appear in a percentEncoded string.
}
示例4: getSignature
import net.oauth.OAuth; //导入方法依赖的package包/类
private synchronized String getSignature() {
if (signature == null) {
signature = OAuth.percentEncode(getConsumerSecret()) + '&'
+ OAuth.percentEncode(getTokenSecret());
}
return signature;
}
示例5: ComparableParameter
import net.oauth.OAuth; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
ComparableParameter(Map.Entry value) {
this.value = value;
String n = toString(value.getKey());
String v = toString(value.getValue());
this.key = OAuth.percentEncode(n) + ' ' + OAuth.percentEncode(v);
// ' ' is used because it comes before any character
// that can appear in a percentEncoded string.
}