|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jets3t.service.impl.rest.httpclient.RepeatableRequestEntity
public class RepeatableRequestEntity
An HttpClient request entity whose underlying data can be re-read (that is, repeated) if necessary to retry failed transmissions. This class also provides basic byte-rate throttling by throttling the reading of request bodies, the throttling value is set with the JetS3t property httpclient.read-throttle. If Logging is enabled for this class the MD5 hash values (Base64 and Hex) are logged after all data has been written to the output stream.
This class works by taking advantage of the reset capability of the original data input stream, or by wrapping the input stream in a reset-able class if it is not so capable.
When data is repeated, any attached ProgressMonitoredInputStream
is notified
that a repeat transmission is occurring.
Constructor Summary | |
---|---|
RepeatableRequestEntity(String name,
InputStream is,
String contentType,
long contentLength,
Jets3tProperties jets3tProperties,
boolean enableLiveMD5Hashing)
Creates a repeatable request entity for the input stream provided. |
Method Summary | |
---|---|
long |
getContentLength()
|
String |
getContentType()
|
byte[] |
getMD5DigestOfData()
|
boolean |
isRepeatable()
|
void |
writeRequest(OutputStream out)
Writes the request to the output stream. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RepeatableRequestEntity(String name, InputStream is, String contentType, long contentLength, Jets3tProperties jets3tProperties, boolean enableLiveMD5Hashing)
If the input stream provided, or any underlying wrapped input streams, supports the
InputStream.reset()
method then it will be capable of repeating data
transmission. If the input stream provided does not supports this method, it will
automatically be wrapped in a RepeatableInputStream
-- in this case, the data
read from the wrapped input stream will be buffered up to the limit set by the JetS3t
property uploads.stream-retry-buffer-size (default: 131072 bytes).
This constructor also detects when an underlying ProgressMonitoredInputStream
is
present, and will notify this monitor if a repeat occurs.
If the JetS3t properties option httpclient.read-throttle
is set to a
non-zero value, all simultaneous uploads performed by this class will be throttled
to the specified speed.
is
- the input stream that supplies the data to be made repeatable.contentType
- contentLength
- enableLiveMD5Hashing
- if true, data that passes through the object will be hashed to an MD5 digest
and this digest will be available from getMD5DigestOfData()
. If false,
the digest will not be calculated.Method Detail |
---|
public long getContentLength()
getContentLength
in interface org.apache.commons.httpclient.methods.RequestEntity
public String getContentType()
getContentType
in interface org.apache.commons.httpclient.methods.RequestEntity
public boolean isRepeatable()
isRepeatable
in interface org.apache.commons.httpclient.methods.RequestEntity
writeRequest(OutputStream)
method when the repeat is attempted.public void writeRequest(OutputStream out) throws IOException
InputStream.reset()
.
If a ProgressMonitoredInputStream
is attached, this monitor will be notified that
data is being repeated by being reset with
ProgressMonitoredInputStream.resetProgressMonitor()
.
writeRequest
in interface org.apache.commons.httpclient.methods.RequestEntity
IOException
public byte[] getMD5DigestOfData()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |