Package oauth.signpost.commonshttp
Class CommonsHttpOAuthProvider
- java.lang.Object
-
- oauth.signpost.AbstractOAuthProvider
-
- oauth.signpost.commonshttp.CommonsHttpOAuthProvider
-
- All Implemented Interfaces:
Serializable,OAuthProvider
public class CommonsHttpOAuthProvider extends AbstractOAuthProvider
This implementation uses the Apache CommonsHttpClient4.x HTTP implementation to fetch OAuth tokens from a service provider. Android users should use this provider implementation in favor of the default one, since the latter is known to cause problems with Android's Apache Harmony underpinnings.- Author:
- Matthias Kaeppler
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CommonsHttpOAuthProvider(String requestTokenEndpointUrl, String accessTokenEndpointUrl, String authorizationWebsiteUrl)CommonsHttpOAuthProvider(String requestTokenEndpointUrl, String accessTokenEndpointUrl, String authorizationWebsiteUrl, org.apache.http.client.HttpClient httpClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseConnection(HttpRequest request, HttpResponse response)Called when the connection is being finalized after receiving the response.protected HttpRequestcreateRequest(String endpointUrl)Overrride this method if you want to customize the logic for building a request object for the given endpoint URL.protected HttpResponsesendRequest(HttpRequest request)Override this method if you want to customize the logic for how the given request is sent to the server.voidsetHttpClient(org.apache.http.client.HttpClient httpClient)-
Methods inherited from class oauth.signpost.AbstractOAuthProvider
getAccessTokenEndpointUrl, getAuthorizationWebsiteUrl, getRequestHeaders, getRequestTokenEndpointUrl, getResponseParameter, getResponseParameters, handleUnexpectedResponse, isOAuth10a, removeListener, retrieveAccessToken, retrieveRequestToken, retrieveToken, setListener, setOAuth10a, setRequestHeader, setResponseParameters
-
-
-
-
Method Detail
-
setHttpClient
public void setHttpClient(org.apache.http.client.HttpClient httpClient)
-
createRequest
protected HttpRequest createRequest(String endpointUrl) throws Exception
Description copied from class:AbstractOAuthProviderOverrride this method if you want to customize the logic for building a request object for the given endpoint URL.- Specified by:
createRequestin classAbstractOAuthProvider- Parameters:
endpointUrl- the URL to which the request will go- Returns:
- the request object
- Throws:
Exception- if something breaks
-
sendRequest
protected HttpResponse sendRequest(HttpRequest request) throws Exception
Description copied from class:AbstractOAuthProviderOverride this method if you want to customize the logic for how the given request is sent to the server.- Specified by:
sendRequestin classAbstractOAuthProvider- Parameters:
request- the request to send- Returns:
- the response to the request
- Throws:
Exception- if something breaks
-
closeConnection
protected void closeConnection(HttpRequest request, HttpResponse response) throws Exception
Description copied from class:AbstractOAuthProviderCalled when the connection is being finalized after receiving the response. Use this to do any cleanup / resource freeing.- Overrides:
closeConnectionin classAbstractOAuthProvider- Parameters:
request- the request that has been sentresponse- the response that has been received- Throws:
Exception- if something breaks
-
-