Interface IHttpManager

  • All Known Implementing Classes:
    SpotifyHttpManager


    public interface IHttpManager
    A simple HTTP connection interface.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      String delete​(URI uri, org.apache.http.Header[] headers, org.apache.http.HttpEntity body)
      Perform an HTTP DELETE request to the specified URL.
      String get​(URI uri, org.apache.http.Header[] headers)
      Perform an HTTP GET request to the specified URL.
      String post​(URI uri, org.apache.http.Header[] headers, org.apache.http.HttpEntity body)
      Perform an HTTP POST request to the specified URL.
      String put​(URI uri, org.apache.http.Header[] headers, org.apache.http.HttpEntity body)
      Perform an HTTP PUT request to the specified URL.
    • Method Detail

      • get

        String get​(URI uri,
                   org.apache.http.Header[] headers)
            throws IOException,
                   SpotifyWebApiException
        Perform an HTTP GET request to the specified URL.
        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.
      • post

        String post​(URI uri,
                    org.apache.http.Header[] headers,
                    org.apache.http.HttpEntity body)
             throws IOException,
                    SpotifyWebApiException
        Perform an HTTP POST request to the specified URL.
        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.
      • put

        String put​(URI uri,
                   org.apache.http.Header[] headers,
                   org.apache.http.HttpEntity body)
            throws IOException,
                   SpotifyWebApiException
        Perform an HTTP PUT request to the specified URL.
        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.
      • delete

        String delete​(URI uri,
                      org.apache.http.Header[] headers,
                      org.apache.http.HttpEntity body)
               throws IOException,
                      SpotifyWebApiException
        Perform an HTTP DELETE request to the specified URL.
        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.