Class SpotifyHttpManager

  • All Implemented Interfaces:
    IHttpManager

    public class SpotifyHttpManager
    extends java.lang.Object
    implements IHttpManager
    • Method Summary

      Modifier and Type Method Description
      java.lang.String delete​(java.net.URI uri, org.apache.http.Header[] headers, org.apache.http.HttpEntity body)
      Perform an HTTP DELETE request to the specified URL.
      java.lang.String get​(java.net.URI uri, org.apache.http.Header[] headers)
      Perform an HTTP GET request to the specified URL.
      java.lang.Integer getCacheMaxEntries()  
      java.lang.Integer getCacheMaxObjectSize()  
      java.lang.Integer getConnectionRequestTimeout()  
      java.lang.Integer getConnectTimeout()  
      org.apache.http.HttpHost getProxy()  
      org.apache.http.auth.UsernamePasswordCredentials getProxyCredentials()  
      java.lang.Integer getSocketTimeout()  
      static java.net.URI makeUri​(java.lang.String uriString)  
      java.lang.String post​(java.net.URI uri, org.apache.http.Header[] headers, org.apache.http.HttpEntity body)
      Perform an HTTP POST request to the specified URL.
      java.lang.String put​(java.net.URI uri, org.apache.http.Header[] headers, org.apache.http.HttpEntity body)
      Perform an HTTP PUT request to the specified URL.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SpotifyHttpManager

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

      • makeUri

        public static java.net.URI makeUri​(java.lang.String uriString)
      • getProxy

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

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

        public java.lang.Integer getCacheMaxEntries()
      • getCacheMaxObjectSize

        public java.lang.Integer getCacheMaxObjectSize()
      • getConnectionRequestTimeout

        public java.lang.Integer getConnectionRequestTimeout()
      • getConnectTimeout

        public java.lang.Integer getConnectTimeout()
      • getSocketTimeout

        public java.lang.Integer getSocketTimeout()
      • get

        public java.lang.String get​(java.net.URI uri,
                                    org.apache.http.Header[] headers)
                             throws java.io.IOException,
                                    SpotifyWebApiException
        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:
        java.io.IOException - In case of networking issues.
        SpotifyWebApiException - The Web API returned an error further specified in this exception's root cause.
      • post

        public java.lang.String post​(java.net.URI uri,
                                     org.apache.http.Header[] headers,
                                     org.apache.http.HttpEntity body)
                              throws java.io.IOException,
                                     SpotifyWebApiException
        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:
        java.io.IOException - In case of networking issues.
        SpotifyWebApiException - The Web API returned an error further specified in this exception's root cause.
      • put

        public java.lang.String put​(java.net.URI uri,
                                    org.apache.http.Header[] headers,
                                    org.apache.http.HttpEntity body)
                             throws java.io.IOException,
                                    SpotifyWebApiException
        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:
        java.io.IOException - In case of networking issues.
        SpotifyWebApiException - The Web API returned an error further specified in this exception's root cause.
      • delete

        public java.lang.String delete​(java.net.URI uri,
                                       org.apache.http.Header[] headers,
                                       org.apache.http.HttpEntity body)
                                throws java.io.IOException,
                                       SpotifyWebApiException
        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:
        java.io.IOException - In case of networking issues.
        SpotifyWebApiException - The Web API returned an error further specified in this exception's root cause.