public abstract class URLRetriever extends WWObjectImpl implements Retriever
| Modifier and Type | Field and Description |
|---|---|
protected long |
beginTime |
protected ByteBuffer |
byteBuffer |
protected URLConnection |
connection |
protected int |
connectTimeout |
protected int |
contentLength |
protected AtomicInteger |
contentLengthRead |
protected String |
contentType |
protected long |
endTime |
protected AtomicLong |
expiration |
static String |
EXTRACT_ZIP_ENTRY
Applications never need to use this constant.
|
protected RetrievalPostProcessor |
postProcessor |
protected int |
readTimeout |
protected int |
staleRequestLimit |
protected String |
state |
protected long |
submitTime |
protected URL |
url |
RETRIEVER_STATE_CONNECTING, RETRIEVER_STATE_ERROR, RETRIEVER_STATE_INTERRUPTED, RETRIEVER_STATE_NOT_STARTED, RETRIEVER_STATE_READING, RETRIEVER_STATE_STARTED, RETRIEVER_STATE_SUCCESSFUL| Constructor and Description |
|---|
URLRetriever(URL url,
RetrievalPostProcessor postProcessor) |
| Modifier and Type | Method and Description |
|---|---|
Retriever |
call() |
protected void |
configureSSLContext(HttpsURLConnection connection) |
static URLRetriever |
createRetriever(URL url,
RetrievalPostProcessor postProcessor)
Create the appropriate retriever for a URL's protocol.
|
protected ByteBuffer |
doRead(URLConnection connection) |
protected void |
end() |
boolean |
equals(Object o) |
long |
getBeginTime() |
ByteBuffer |
getBuffer() |
protected URLConnection |
getConnection() |
int |
getConnectTimeout() |
int |
getContentLength() |
int |
getContentLengthRead() |
String |
getContentType() |
long |
getEndTime() |
protected long |
getExpiration(URLConnection connection)
Indicates the expiration time specified by either the Expires header or the max-age directive of the
Cache-Control header.
|
long |
getExpirationTime()
Indicates the expiration time of the resource retrieved by this Retriever.
|
String |
getName() |
RetrievalPostProcessor |
getPostProcessor() |
int |
getReadTimeout() |
int |
getStaleRequestLimit() |
String |
getState() |
long |
getSubmitTime() |
URL |
getUrl() |
URL |
getURL() |
int |
hashCode() |
protected boolean |
interrupted() |
protected URLConnection |
openConnection() |
protected ByteBuffer |
read() |
protected ByteBuffer |
readNonSpecificStream(InputStream inputStream,
URLConnection connection) |
protected ByteBuffer |
readNonSpecificStreamUnknownLength(InputStream inputStream) |
protected ByteBuffer |
readZipStream(InputStream inputStream,
URL url) |
void |
setBeginTime(long beginTime) |
void |
setConnectTimeout(int connectTimeout) |
protected void |
setContentLengthRead(int length) |
void |
setEndTime(long endTime) |
void |
setReadTimeout(int readTimeout) |
void |
setStaleRequestLimit(int staleRequestLimit) |
protected void |
setState(String state) |
void |
setSubmitTime(long submitTime) |
String |
toString() |
onMessage, propertyChangeaddPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValuesclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValuespropertyChangeonMessageprotected long beginTime
protected volatile ByteBuffer byteBuffer
protected volatile URLConnection connection
protected int connectTimeout
protected volatile int contentLength
protected AtomicInteger contentLengthRead
protected volatile String contentType
protected long endTime
protected AtomicLong expiration
public static final String EXTRACT_ZIP_ENTRY
protected final RetrievalPostProcessor postProcessor
protected int readTimeout
protected int staleRequestLimit
protected volatile String state
protected long submitTime
protected final URL url
public URLRetriever(URL url, RetrievalPostProcessor postProcessor)
url - the URL of the resource to retrieve.postProcessor - the retrieval post-processor to invoke when the resource is retrieved. May be null.IllegalArgumentException - if url.protected void configureSSLContext(HttpsURLConnection connection)
public static URLRetriever createRetriever(URL url, RetrievalPostProcessor postProcessor)
url - the url that will be the source of the retrieval.postProcessor - the retriever's post-processor.IllegalArgumentException - if the url is null.protected ByteBuffer doRead(URLConnection connection) throws Exception
connection - the connection to read from.Exception - if connection is null or an exception occurs during reading.IllegalArgumentException - if connection is nullpublic long getBeginTime()
getBeginTime in interface Retrieverpublic final ByteBuffer getBuffer()
protected final URLConnection getConnection()
public final int getConnectTimeout()
getConnectTimeout in interface Retrieverpublic final int getContentLength()
getContentLength in interface Retrieverpublic final int getContentLengthRead()
getContentLengthRead in interface Retrieverpublic final String getContentType()
getContentType in interface Retrieverpublic long getEndTime()
getEndTime in interface Retrieverprotected long getExpiration(URLConnection connection)
connection - Connection for which to get expiration time.public long getExpirationTime()
getExpirationTime in interface Retrieverpublic final RetrievalPostProcessor getPostProcessor()
public int getReadTimeout()
getReadTimeout in interface Retrieverpublic int getStaleRequestLimit()
getStaleRequestLimit in interface Retrieverpublic long getSubmitTime()
getSubmitTime in interface Retrieverpublic final URL getUrl()
public final URL getURL()
protected boolean interrupted()
protected URLConnection openConnection() throws IOException
IOExceptionprotected ByteBuffer read() throws Exception
Exceptionprotected ByteBuffer readNonSpecificStream(InputStream inputStream, URLConnection connection) throws IOException
IOExceptionprotected ByteBuffer readNonSpecificStreamUnknownLength(InputStream inputStream) throws IOException
IOExceptionprotected ByteBuffer readZipStream(InputStream inputStream, URL url) throws IOException
inputStream - a stream to the zip connection.url - the URL of the zip resource.IOException - if the stream does not refer to a zip resource or an exception occurs during
reading.IllegalArgumentException - if inputStream is nullpublic void setBeginTime(long beginTime)
setBeginTime in interface Retrieverpublic final void setConnectTimeout(int connectTimeout)
setConnectTimeout in interface Retrieverprotected void setContentLengthRead(int length)
public void setEndTime(long endTime)
setEndTime in interface Retrieverpublic void setReadTimeout(int readTimeout)
setReadTimeout in interface Retrieverpublic void setStaleRequestLimit(int staleRequestLimit)
setStaleRequestLimit in interface Retrieverprotected void setState(String state)
public void setSubmitTime(long submitTime)
setSubmitTime in interface Retriever