public class ApacheHttpClientDownloadTask extends DefaultTask implements DownloadAction
ApacheHttpClientDownloadAction.
Created by covers1624 on 22/11/21.
DownloadAction.Dest| Constructor and Description |
|---|
ApacheHttpClientDownloadTask() |
| Modifier and Type | Method and Description |
|---|---|
DownloadAction |
addRequestHeader(java.lang.String key,
java.lang.String value)
Adds an arbitrary Http header to the action.
|
void |
execute()
Execute the download action.
|
CloseableHttpClient |
getClient() |
DownloadAction.Dest |
getDest() |
DownloadListener |
getDownloadListener() |
boolean |
getOnlyIfModified() |
boolean |
getQuiet() |
java.lang.String |
getUrl() |
boolean |
getUseETag() |
java.lang.String |
getUserAgent() |
boolean |
isUpToDate() |
ApacheHttpClientDownloadTask |
setClient(CloseableHttpClient client) |
ApacheHttpClientDownloadTask |
setDest(DownloadAction.Dest dest)
Set the Destination to download content to.
|
ApacheHttpClientDownloadTask |
setDest(java.io.File file)
Set the
File to download content to. |
ApacheHttpClientDownloadTask |
setDest(java.io.OutputStream os)
Set the
OutputStream to download content to. |
ApacheHttpClientDownloadTask |
setDest(java.nio.file.Path path)
Set the
Path to download content to. |
ApacheHttpClientDownloadTask |
setDest(java.io.StringWriter sw)
Set the
StringWriter to download content to. |
ApacheHttpClientDownloadTask |
setDownloadListener(DownloadListener downloadListener)
Set the
DownloadListener to use. |
ApacheHttpClientDownloadTask |
setOnlyIfModified(boolean onlyIfModified)
If this Download action should use
If-Modified-Since
HTTP request header. |
ApacheHttpClientDownloadTask |
setQuiet(boolean quiet)
If this download action should not log things.
|
ApacheHttpClientDownloadTask |
setUrl(java.lang.String url)
Set the URL to download from.
|
ApacheHttpClientDownloadTask |
setUseETag(boolean useETag)
If this download action should use
If-None-Match
HTTP request header. |
ApacheHttpClientDownloadTask |
setUserAgent(java.lang.String userAgent)
Sets the
User-Agent HTTP request header. |
public void execute()
throws java.io.IOException
DownloadActionexecute in interface DownloadActionjava.io.IOException - If an IO error occurs whilst downloading.HttpResponseException - If the response code was not expected.public ApacheHttpClientDownloadTask setClient(CloseableHttpClient client)
public ApacheHttpClientDownloadTask setUrl(java.lang.String url)
DownloadActionsetUrl in interface DownloadActionurl - The URL.public ApacheHttpClientDownloadTask setDest(DownloadAction.Dest dest)
DownloadActionsetDest in interface DownloadActiondest - The Destination.public ApacheHttpClientDownloadTask setDest(java.io.StringWriter sw)
DownloadActionStringWriter to download content to.setDest in interface DownloadActionsw - The StringWriter.public ApacheHttpClientDownloadTask setDest(java.io.OutputStream os)
DownloadActionOutputStream to download content to.setDest in interface DownloadActionos - The OutputStream.public ApacheHttpClientDownloadTask setDest(java.io.File file)
DownloadActionFile to download content to.setDest in interface DownloadActionfile - The file.public ApacheHttpClientDownloadTask setDest(java.nio.file.Path path)
DownloadActionPath to download content to.setDest in interface DownloadActionpath - The path.public ApacheHttpClientDownloadTask setOnlyIfModified(boolean onlyIfModified)
DownloadActionIf-Modified-Since
HTTP request header.setOnlyIfModified in interface DownloadActiononlyIfModified - If If-Modified-Since should be used.public ApacheHttpClientDownloadTask setUseETag(boolean useETag)
DownloadActionIf-None-Match
HTTP request header.setUseETag in interface DownloadActionuseETag - If If-None-Match should be used.public ApacheHttpClientDownloadTask setQuiet(boolean quiet)
DownloadActionsetQuiet in interface DownloadActionquiet - If the download action should be quiet.public ApacheHttpClientDownloadTask setUserAgent(java.lang.String userAgent)
DownloadActionUser-Agent HTTP request header.setUserAgent in interface DownloadActionuserAgent - The User-Agent request header.public DownloadAction addRequestHeader(java.lang.String key, java.lang.String value)
DownloadActionaddRequestHeader in interface DownloadActionkey - The key.value - The value.public ApacheHttpClientDownloadTask setDownloadListener(DownloadListener downloadListener)
DownloadActionDownloadListener to use.setDownloadListener in interface DownloadActiondownloadListener - The DownloadListener.public CloseableHttpClient getClient()
public java.lang.String getUrl()
getUrl in interface DownloadActionpublic DownloadAction.Dest getDest()
getDest in interface DownloadActionpublic boolean getOnlyIfModified()
getOnlyIfModified in interface DownloadActionpublic boolean getUseETag()
getUseETag in interface DownloadActionpublic boolean getQuiet()
getQuiet in interface DownloadActionpublic java.lang.String getUserAgent()
getUserAgent in interface DownloadActionpublic DownloadListener getDownloadListener()
getDownloadListener in interface DownloadActionpublic boolean isUpToDate()
isUpToDate in interface DownloadAction