try {
// generate the complete URL first
signature = HMACEncryptionUtility.generateHMACSignature(url, method, consumerSecret, tokenSecret,
treeMap);
} catch (Exception e) {
throw new OAuthException(e, "createAuthorizationHeader failed with Exception");
}
StringBuilder headerStr = new StringBuilder();
headerStr.append("OAuth ").append(Configuration.CONSUMER_KEY).append("=\"").append(consumerKey)
.append("\"");
headerStr.append(",").append(Configuration.NONCE).append("=\"").append(nonce).append("\"");
try {
headerStr.append(",").append(Configuration.SIGNATURE).append("=\"")
.append(URLEncoder.encode(signature, "UTF-8")).append("\"");
} catch (UnsupportedEncodingException e1) {
throw new OAuthException(e1,
"createAuthorizationHeader failed with UnsupportedEncodingException");
}
headerStr.append(",").append(Configuration.SIGNATURE_METHOD).append("=\"")
.append(getSignatureMethod()).append("\"");
headerStr.append(",").append(Configuration.TIMESTAMP).append("=\"").append(timeStamp).append("\"");