Package oauth.signpost.commonshttp
Class CommonsHttpOAuthProvider
- java.lang.Object
-
- oauth.signpost.AbstractOAuthProvider
-
- oauth.signpost.commonshttp.CommonsHttpOAuthProvider
-
- All Implemented Interfaces:
java.io.Serializable
,OAuthProvider
public class CommonsHttpOAuthProvider extends AbstractOAuthProvider
This implementation uses the Apache CommonsHttpClient
4.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.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.http.client.HttpClient
httpClient
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description CommonsHttpOAuthProvider(java.lang.String requestTokenEndpointUrl, java.lang.String accessTokenEndpointUrl, java.lang.String authorizationWebsiteUrl)
CommonsHttpOAuthProvider(java.lang.String requestTokenEndpointUrl, java.lang.String accessTokenEndpointUrl, java.lang.String authorizationWebsiteUrl, org.apache.http.client.HttpClient httpClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeConnection(HttpRequest request, HttpResponse response)
Called when the connection is being finalized after receiving the response.protected HttpRequest
createRequest(java.lang.String endpointUrl)
Overrride this method if you want to customize the logic for building a request object for the given endpoint URL.protected HttpResponse
sendRequest(HttpRequest request)
Override this method if you want to customize the logic for how the given request is sent to the server.void
setHttpClient(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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
httpClient
private transient org.apache.http.client.HttpClient httpClient
-
-
Constructor Detail
-
CommonsHttpOAuthProvider
public CommonsHttpOAuthProvider(java.lang.String requestTokenEndpointUrl, java.lang.String accessTokenEndpointUrl, java.lang.String authorizationWebsiteUrl)
-
CommonsHttpOAuthProvider
public CommonsHttpOAuthProvider(java.lang.String requestTokenEndpointUrl, java.lang.String accessTokenEndpointUrl, java.lang.String authorizationWebsiteUrl, org.apache.http.client.HttpClient httpClient)
-
-
Method Detail
-
setHttpClient
public void setHttpClient(org.apache.http.client.HttpClient httpClient)
-
createRequest
protected HttpRequest createRequest(java.lang.String endpointUrl) throws java.lang.Exception
Description copied from class:AbstractOAuthProvider
Overrride this method if you want to customize the logic for building a request object for the given endpoint URL.- Specified by:
createRequest
in classAbstractOAuthProvider
- Parameters:
endpointUrl
- the URL to which the request will go- Returns:
- the request object
- Throws:
java.lang.Exception
- if something breaks
-
sendRequest
protected HttpResponse sendRequest(HttpRequest request) throws java.lang.Exception
Description copied from class:AbstractOAuthProvider
Override this method if you want to customize the logic for how the given request is sent to the server.- Specified by:
sendRequest
in classAbstractOAuthProvider
- Parameters:
request
- the request to send- Returns:
- the response to the request
- Throws:
java.lang.Exception
- if something breaks
-
closeConnection
protected void closeConnection(HttpRequest request, HttpResponse response) throws java.lang.Exception
Description copied from class:AbstractOAuthProvider
Called when the connection is being finalized after receiving the response. Use this to do any cleanup / resource freeing.- Overrides:
closeConnection
in classAbstractOAuthProvider
- Parameters:
request
- the request that has been sentresponse
- the response that has been received- Throws:
java.lang.Exception
- if something breaks
-
-