use of org.apache.shindig.gadgets.http.HttpResponse in project liferay-ide by liferay.
the class OAuthRequest method fetchData.
/**
* Get honest-to-goodness user data.
*
* @throws OAuthProtocolException if the service provider returns an OAuth
* related error instead of user data.
*/
private HttpResponseBuilder fetchData() throws OAuthRequestException, OAuthProtocolException {
HttpResponseBuilder builder = null;
if (accessTokenData != null) {
// This is a request for access token data, return it.
builder = formatAccessTokenData();
} else {
HttpRequest signed = sanitizeAndSign(realRequest, null, false);
HttpResponse response = fetchFromServer(signed);
checkForProtocolProblem(response);
builder = new HttpResponseBuilder(response);
}
return builder;
}
use of org.apache.shindig.gadgets.http.HttpResponse in project liferay-ide by liferay.
the class OAuthRequest method sendOAuthMessage.
/**
* Sends OAuth request token and access token messages.
*/
private OAuthMessage sendOAuthMessage(HttpRequest request) throws OAuthRequestException, OAuthProtocolException {
HttpResponse response = fetchFromServer(request);
checkForProtocolProblem(response);
OAuthMessage reply = new OAuthMessage(null, null, null);
reply.addParameters(OAuth.decodeForm(response.getResponseAsString()));
reply = parseAuthHeader(reply, response);
if (OAuthUtil.getParameter(reply, OAuth.OAUTH_TOKEN) == null) {
throw new OAuthRequestException(OAuthError.MISSING_OAUTH_PARAMETER, OAuth.OAUTH_TOKEN);
}
if (OAuthUtil.getParameter(reply, OAuth.OAUTH_TOKEN_SECRET) == null) {
throw new OAuthRequestException(OAuthError.MISSING_OAUTH_PARAMETER, OAuth.OAUTH_TOKEN_SECRET);
}
return reply;
}
Aggregations