Class GetURL
java.lang.Object
org.deltava.dao.http.DAO
org.deltava.dao.http.GetURL
A Data Access Object to download a file via HTTP.
- Since:
- 5.0
- Version:
- 11.6
- Author:
- Luke
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondownload()
Downloads the file.int
Returns the HTTP status code for this request.boolean
Checks whether the URL is available for download.byte[]
load()
Loads a URL into a buffer.void
setForce
(boolean doForce) Forces file download even if the remote resource has not changed.void
Updates the timestamp used to send an If-Modified-Since header.Methods inherited from class org.deltava.dao.http.DAO
getCompression, getHeaderField, getIn, getOut, getResponseCode, init, reset, setAuthentication, setCompression, setConnectTimeout, setMethod, setReadTimeout, setRequestHeader, setReturnErrorStream
-
Constructor Details
-
GetURL
-
-
Method Details
-
getStatusCode
public int getStatusCode()Returns the HTTP status code for this request.- Returns:
- the HTTP status code
-
setForce
public void setForce(boolean doForce) Forces file download even if the remote resource has not changed.- Parameters:
doForce
- TRUE if download is forced, otherwise FALSE
-
setIfModifiedSince
Updates the timestamp used to send an If-Modified-Since header.- Parameters:
dt
- the date/time
-
download
Downloads the file.- Returns:
- TRUE if a new copy was downloaded, otherwise FALSE
- Throws:
DAOException
- if an error occurs
-
load
Loads a URL into a buffer.- Returns:
- the buffer
- Throws:
DAOException
- if an error occurs
-
isAvailable
Checks whether the URL is available for download.- Returns:
- TRUE if content is available, otherwise FALSE
- Throws:
DAOException
- if an unexpected error occurs
-