Class SpotifyHttpManager

java.lang.Object
se.michaelthelin.spotify.SpotifyHttpManager
All Implemented Interfaces:
IHttpManager

public class SpotifyHttpManager extends Object implements IHttpManager
  • Constructor Details

    • SpotifyHttpManager

      public SpotifyHttpManager(SpotifyHttpManager.Builder builder)
      Construct a new SpotifyHttpManager instance.
      Parameters:
      builder - The builder.
  • Method Details

    • makeUri

      public static URI makeUri(String uriString)
    • getProxy

      public org.apache.hc.core5.http.HttpHost getProxy()
    • getProxyCredentials

      public org.apache.hc.client5.http.auth.UsernamePasswordCredentials getProxyCredentials()
    • getCacheMaxEntries

      public Integer getCacheMaxEntries()
    • getCacheMaxObjectSize

      public Integer getCacheMaxObjectSize()
    • getConnectionRequestTimeout

      public Integer getConnectionRequestTimeout()
    • getConnectTimeout

      public Integer getConnectTimeout()
    • getSocketTimeout

      public Integer getSocketTimeout()
    • get

      public String get(URI uri, org.apache.hc.core5.http.Header[] headers) throws IOException, SpotifyWebApiException, org.apache.hc.core5.http.ParseException
      Description copied from interface: IHttpManager
      Perform an HTTP GET request to the specified URL.
      Specified by:
      get in interface IHttpManager
      Parameters:
      uri - The GET request's URI.
      headers - The GET request's Headers.
      Returns:
      A string containing the GET request's response body.
      Throws:
      IOException - In case of networking issues.
      SpotifyWebApiException - The Web API returned an error further specified in this exception's root cause.
      org.apache.hc.core5.http.ParseException - The response could not be parsed as a string.
    • post

      public String post(URI uri, org.apache.hc.core5.http.Header[] headers, org.apache.hc.core5.http.HttpEntity body) throws IOException, SpotifyWebApiException, org.apache.hc.core5.http.ParseException
      Description copied from interface: IHttpManager
      Perform an HTTP POST request to the specified URL.
      Specified by:
      post in interface IHttpManager
      Parameters:
      uri - The POST request's URI.
      headers - The POST request's Headers.
      body - The PUT request's body as a HttpEntity.
      Returns:
      A string containing the POST request's response body.
      Throws:
      IOException - In case of networking issues.
      SpotifyWebApiException - The Web API returned an error further specified in this exception's root cause.
      org.apache.hc.core5.http.ParseException - The response could not be parsed as a string.
    • put

      public String put(URI uri, org.apache.hc.core5.http.Header[] headers, org.apache.hc.core5.http.HttpEntity body) throws IOException, SpotifyWebApiException, org.apache.hc.core5.http.ParseException
      Description copied from interface: IHttpManager
      Perform an HTTP PUT request to the specified URL.
      Specified by:
      put in interface IHttpManager
      Parameters:
      uri - The PUT request's URI.
      headers - The PUT request's Headers.
      body - The PUT request's body as a HttpEntity.
      Returns:
      A string containing the PUT request's response body.
      Throws:
      IOException - In case of networking issues.
      SpotifyWebApiException - The Web API returned an error further specified in this exception's root cause.
      org.apache.hc.core5.http.ParseException - The response could not be parsed as a string.
    • delete

      public String delete(URI uri, org.apache.hc.core5.http.Header[] headers, org.apache.hc.core5.http.HttpEntity body) throws IOException, SpotifyWebApiException, org.apache.hc.core5.http.ParseException
      Description copied from interface: IHttpManager
      Perform an HTTP DELETE request to the specified URL.
      Specified by:
      delete in interface IHttpManager
      Parameters:
      uri - The DELETE request's URI.
      headers - The DELETE request's Headers.
      body - The DELETE request's body as a HttpEntity.
      Returns:
      A string containing the DELETE request's response body.
      Throws:
      IOException - In case of networking issues.
      SpotifyWebApiException - The Web API returned an error further specified in this exception's root cause.
      org.apache.hc.core5.http.ParseException - The response could not be parsed as a string.