@ThreadSafe public class DefaultResourceRetriever extends Object implements ResourceRetriever
| Constructor and Description |
|---|
DefaultResourceRetriever()
Creates a new resource retriever.
|
DefaultResourceRetriever(int connectTimeout,
int readTimeout)
Creates a new resource retriever.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getConnectTimeout()
Gets the HTTP connect timeout.
|
int |
getReadTimeout()
Gets the HTTP read timeout.
|
Resource |
retrieveResource(URL url)
Retrieves the resource from the specified HTTP(S) URL.
|
void |
setConnectTimeout(int connectTimeout)
Sets the HTTP connect timeout.
|
void |
setReadTimeout(int readTimeout)
Sets the HTTP read timeout.
|
public DefaultResourceRetriever()
public DefaultResourceRetriever(int connectTimeout, int readTimeout)
connectTimeout - The HTTP connects timeout, in milliseconds,
zero for infinite. Must not be negative.readTimeout - The HTTP read timeout, in milliseconds, zero
for infinite. Must not be negative.public int getConnectTimeout()
public void setConnectTimeout(int connectTimeout)
connectTimeout - The HTTP connect timeout, in milliseconds,
zero for infinite. Must not be negative.public int getReadTimeout()
public void setReadTimeout(int readTimeout)
readTimeout - The HTTP read timeout, in milliseconds, zero for
infinite. Must not be negative.public Resource retrieveResource(URL url) throws IOException
ResourceRetrieverretrieveResource in interface ResourceRetrieverurl - The URL of the resource. Its scheme must be HTTP or
HTTPS. Must not be null.IOException - If the HTTP connection to the specified URL
failed or the resource couldn't be retrieved.Copyright © 2015 Connect2id Ltd.. All Rights Reserved.