Package com.wrapper.spotify
Class SpotifyHttpManager
java.lang.Object
com.wrapper.spotify.SpotifyHttpManager
- All Implemented Interfaces:
IHttpManager
public class SpotifyHttpManager extends Object implements IHttpManager
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSpotifyHttpManager.Builder -
Constructor Summary
Constructors Constructor Description SpotifyHttpManager(SpotifyHttpManager.Builder builder)Construct a new SpotifyHttpManager instance. -
Method Summary
Modifier and Type Method Description Stringdelete(URI uri, org.apache.hc.core5.http.Header[] headers, org.apache.hc.core5.http.HttpEntity body)Perform an HTTP DELETE request to the specified URL.Stringget(URI uri, org.apache.hc.core5.http.Header[] headers)Perform an HTTP GET request to the specified URL.IntegergetCacheMaxEntries()IntegergetCacheMaxObjectSize()IntegergetConnectionRequestTimeout()IntegergetConnectTimeout()org.apache.hc.core5.http.HttpHostgetProxy()org.apache.hc.client5.http.auth.UsernamePasswordCredentialsgetProxyCredentials()IntegergetSocketTimeout()static URImakeUri(String uriString)Stringpost(URI uri, org.apache.hc.core5.http.Header[] headers, org.apache.hc.core5.http.HttpEntity body)Perform an HTTP POST request to the specified URL.Stringput(URI uri, org.apache.hc.core5.http.Header[] headers, org.apache.hc.core5.http.HttpEntity body)Perform an HTTP PUT request to the specified URL.
-
Constructor Details
-
SpotifyHttpManager
Construct a new SpotifyHttpManager instance.- Parameters:
builder- The builder.
-
-
Method Details
-
makeUri
-
getProxy
public org.apache.hc.core5.http.HttpHost getProxy() -
getProxyCredentials
public org.apache.hc.client5.http.auth.UsernamePasswordCredentials getProxyCredentials() -
getCacheMaxEntries
-
getCacheMaxObjectSize
-
getConnectionRequestTimeout
-
getConnectTimeout
-
getSocketTimeout
-
get
public String get(URI uri, org.apache.hc.core5.http.Header[] headers) throws IOException, SpotifyWebApiException, org.apache.hc.core5.http.ParseExceptionDescription copied from interface:IHttpManagerPerform an HTTP GET request to the specified URL.- Specified by:
getin interfaceIHttpManager- Parameters:
uri- The GET request'sURI.headers- The GET request'sHeaders.- 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.ParseExceptionDescription copied from interface:IHttpManagerPerform an HTTP POST request to the specified URL.- Specified by:
postin interfaceIHttpManager- Parameters:
uri- The POST request'sURI.headers- The POST request'sHeaders.body- The PUT request's body as aHttpEntity.- 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.ParseExceptionDescription copied from interface:IHttpManagerPerform an HTTP PUT request to the specified URL.- Specified by:
putin interfaceIHttpManager- Parameters:
uri- The PUT request'sURI.headers- The PUT request'sHeaders.body- The PUT request's body as aHttpEntity.- 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.ParseExceptionDescription copied from interface:IHttpManagerPerform an HTTP DELETE request to the specified URL.- Specified by:
deletein interfaceIHttpManager- Parameters:
uri- The DELETE request'sURI.headers- The DELETE request'sHeaders.body- The DELETE request's body as aHttpEntity.- 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.
-