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 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 Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • httpClient

      private transient org.apache.http.client.HttpClient httpClient
  • Constructor Details

    • CommonsHttpOAuthProvider

      public CommonsHttpOAuthProvider(String requestTokenEndpointUrl, String accessTokenEndpointUrl, String authorizationWebsiteUrl)
    • CommonsHttpOAuthProvider

      public CommonsHttpOAuthProvider(String requestTokenEndpointUrl, String accessTokenEndpointUrl, String authorizationWebsiteUrl, org.apache.http.client.HttpClient httpClient)
  • Method Details

    • setHttpClient

      public void setHttpClient(org.apache.http.client.HttpClient httpClient)
    • createRequest

      protected HttpRequest createRequest(String endpointUrl) throws 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 class AbstractOAuthProvider
      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: 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 class AbstractOAuthProvider
      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: AbstractOAuthProvider
      Called when the connection is being finalized after receiving the response. Use this to do any cleanup / resource freeing.
      Overrides:
      closeConnection in class AbstractOAuthProvider
      Parameters:
      request - the request that has been sent
      response - the response that has been received
      Throws:
      Exception - if something breaks