public abstract class Downloader extends Object
Constructor and Description |
---|
Downloader() |
Modifier and Type | Method and Description |
---|---|
abstract Response |
execute(Request request)
Do a request using the specified
Request object. |
Response |
get(String url)
Do a GET request to get the resource that the url is pointing to.
This method calls get(String, Map, Localization) with the default preferred
localization. |
Response |
get(String url,
Localization localization)
Do a GET request to get the resource that the url is pointing to.
It will set the Accept-Language header to the language of the localization parameter. |
Response |
get(String url,
Map<String,List<String>> headers)
Do a GET request with the specified headers.
|
Response |
get(String url,
Map<String,List<String>> headers,
Localization localization)
Do a GET request with the specified headers.
It will set the Accept-Language header to the language of the localization parameter. |
Response |
head(String url)
Do a HEAD request.
|
Response |
head(String url,
Map<String,List<String>> headers)
Do a HEAD request with the specified headers.
|
Response |
post(String url,
Map<String,List<String>> headers,
byte[] dataToSend)
Do a POST request with the specified headers, sending the data array.
|
Response |
post(String url,
Map<String,List<String>> headers,
byte[] dataToSend,
Localization localization)
Do a POST request with the specified headers, sending the data array.
|
public Response get(String url) throws IOException, ReCaptchaException
get(String, Map, Localization)
with the default preferred
localization. It should only be used when the resource that will be fetched won't be affected
by the localization.url
- the URL that is pointing to the wanted resourceIOException
ReCaptchaException
public Response get(String url, @Nullable Localization localization) throws IOException, ReCaptchaException
Accept-Language
header to the language of the localization parameter.url
- the URL that is pointing to the wanted resourcelocalization
- the source of the value of the Accept-Language
headerIOException
ReCaptchaException
public Response get(String url, @Nullable Map<String,List<String>> headers) throws IOException, ReCaptchaException
url
- the URL that is pointing to the wanted resourceheaders
- a list of headers that will be used in the request.
Any default headers should be overridden by these.IOException
ReCaptchaException
public Response get(String url, @Nullable Map<String,List<String>> headers, @Nullable Localization localization) throws IOException, ReCaptchaException
Accept-Language
header to the language of the localization parameter.url
- the URL that is pointing to the wanted resourceheaders
- a list of headers that will be used in the request.
Any default headers should be overridden by these.localization
- the source of the value of the Accept-Language
headerIOException
ReCaptchaException
public Response head(String url) throws IOException, ReCaptchaException
url
- the URL that is pointing to the wanted resourceIOException
ReCaptchaException
public Response head(String url, @Nullable Map<String,List<String>> headers) throws IOException, ReCaptchaException
url
- the URL that is pointing to the wanted resourceheaders
- a list of headers that will be used in the request.
Any default headers should be overridden by these.IOException
ReCaptchaException
public Response post(String url, @Nullable Map<String,List<String>> headers, @Nullable byte[] dataToSend) throws IOException, ReCaptchaException
url
- the URL that is pointing to the wanted resourceheaders
- a list of headers that will be used in the request.
Any default headers should be overridden by these.dataToSend
- byte array that will be sent when doing the request.IOException
ReCaptchaException
public Response post(String url, @Nullable Map<String,List<String>> headers, @Nullable byte[] dataToSend, @Nullable Localization localization) throws IOException, ReCaptchaException
Accept-Language
header to the language of the localization parameter.url
- the URL that is pointing to the wanted resourceheaders
- a list of headers that will be used in the request.
Any default headers should be overridden by these.dataToSend
- byte array that will be sent when doing the request.localization
- the source of the value of the Accept-Language
headerIOException
ReCaptchaException
public abstract Response execute(@Nonnull Request request) throws IOException, ReCaptchaException
Request
object.IOException
ReCaptchaException