if (accessorInfo.getHttpMethod() == HttpMethod.POST) {
request.setHeader("Content-Type", OAuth.FORM_ENCODED);
}
List<Parameter> msgParams = Lists.newArrayList();
msgParams.add(new Parameter(OAuth.OAUTH_TOKEN, accessor.requestToken));
if (accessorInfo.getSessionHandle() != null) {
msgParams.add(new Parameter(OAuthConstants.OAUTH_SESSION_HANDLE,
accessorInfo.getSessionHandle()));
}
String receivedCallback = realRequest.getOAuthArguments().getReceivedCallbackUrl();
if (!StringUtils.isBlank(receivedCallback)) {
try {
Uri parsed = Uri.parse(receivedCallback);
String verifier = parsed.getQueryParameter(OAuth.OAUTH_VERIFIER);
if (verifier != null) {
msgParams.add(new Parameter(OAuth.OAUTH_VERIFIER, verifier));
}
} catch (IllegalArgumentException e) {
throw new OAuthRequestException(OAuthError.INVALID_REQUEST,
"Invalid received callback URL: " + receivedCallback, e);
}