Class OAuth2HttpClient

java.lang.Object
org.apache.hc.client5.http.impl.classic.CloseableHttpClient
com.mastercard.developer.oauth2.http.apache.OAuth2HttpClient
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.hc.client5.http.classic.HttpClient, org.apache.hc.core5.io.ModalCloseable

public class OAuth2HttpClient extends org.apache.hc.client5.http.impl.classic.CloseableHttpClient
An OAuth2-enabled Apache HttpClient.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new OAuth2-enabled Apache HttpClient using a default HttpClient delegate.
    OAuth2HttpClient(OAuth2Config config, org.apache.hc.client5.http.impl.classic.CloseableHttpClient delegate)
    Creates a new OAuth2-enabled Apache HttpClient.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    close(org.apache.hc.core5.io.CloseMode closeMode)
     
    protected org.apache.hc.client5.http.impl.classic.CloseableHttpResponse
    doExecute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context)
     

    Methods inherited from class org.apache.hc.client5.http.impl.classic.CloseableHttpClient

    execute, execute, execute, execute

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.hc.client5.http.classic.HttpClient

    executeOpen
  • Constructor Details

    • OAuth2HttpClient

      public OAuth2HttpClient(OAuth2Config config, org.apache.hc.client5.http.impl.classic.CloseableHttpClient delegate)
      Creates a new OAuth2-enabled Apache HttpClient.
      Parameters:
      config - A OAuth2 configuration.
      delegate - The underlying HttpClient to delegate requests to.
    • OAuth2HttpClient

      public OAuth2HttpClient(OAuth2Config config)
      Creates a new OAuth2-enabled Apache HttpClient using a default HttpClient delegate.
      Parameters:
      config - A OAuth2 configuration.
  • Method Details

    • doExecute

      protected org.apache.hc.client5.http.impl.classic.CloseableHttpResponse doExecute(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context) throws IOException
      Specified by:
      doExecute in class org.apache.hc.client5.http.impl.classic.CloseableHttpClient
      Throws:
      IOException
    • close

      public void close() throws IOException
      Throws:
      IOException
    • close

      public void close(org.apache.hc.core5.io.CloseMode closeMode)