Package oauth.signpost.commonshttp
Class CommonsHttpOAuthProvider
java.lang.Object
oauth.signpost.AbstractOAuthProvider
oauth.signpost.commonshttp.CommonsHttpOAuthProvider
- All Implemented Interfaces:
Serializable
,OAuthProvider
This implementation uses the Apache Commons
HttpClient
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.http.client.HttpClient
private static final long
-
Constructor Summary
ConstructorsConstructorDescriptionCommonsHttpOAuthProvider
(String requestTokenEndpointUrl, String accessTokenEndpointUrl, String authorizationWebsiteUrl) CommonsHttpOAuthProvider
(String requestTokenEndpointUrl, String accessTokenEndpointUrl, String authorizationWebsiteUrl, org.apache.http.client.HttpClient httpClient) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
closeConnection
(HttpRequest request, HttpResponse response) Called when the connection is being finalized after receiving the response.protected HttpRequest
createRequest
(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 Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
httpClient
private transient org.apache.http.client.HttpClient httpClient
-
-
Constructor Details
-
CommonsHttpOAuthProvider
-
CommonsHttpOAuthProvider
-
-
Method Details
-
setHttpClient
public void setHttpClient(org.apache.http.client.HttpClient httpClient) -
createRequest
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:
Exception
- if something breaks
-
sendRequest
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:
Exception
- if something breaks
-
closeConnection
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:
Exception
- if something breaks
-