java.lang.Object | ||
↳ | org.apache.http.entity.HttpEntityWrapper | |
↳ | org.apache.http.conn.BasicManagedEntity |
An entity that releases a connection
.
A ManagedClientConnection
will
typically not return a managed entity, but you can replace
the unmanaged entity in the response with a managed one.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
attemptReuse | Whether to keep the connection alive. | ||||||||||
managedConn | The connection to release. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.http.entity.HttpEntityWrapper
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new managed entity that can release a connection.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Releases the connection without the option of keep-alive.
| |||||||||||
TODO: The name of this method is misnomer.
| |||||||||||
Indicates that EOF is detected.
| |||||||||||
Creates a new InputStream object of the entity.
| |||||||||||
Tells if the entity is capable to produce its data more than once.
| |||||||||||
Releases the connection with the option of keep-alive.
| |||||||||||
Indicates that the
stream is aborted.
| |||||||||||
Indicates that the
stream is closed.
| |||||||||||
Writes the entity content to the output stream.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Releases the connection gracefully.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.http.entity.HttpEntityWrapper
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.apache.http.HttpEntity
| |||||||||||
From interface
org.apache.http.conn.ConnectionReleaseTrigger
| |||||||||||
From interface
org.apache.http.conn.EofSensorWatcher
|
Creates a new managed entity that can release a connection.
entity | the entity of which to wrap the content. Note that the argument entity can no longer be used afterwards, since the content will be taken by this managed entity. |
---|---|
conn | the connection to release |
reuse | whether the connection should be re-used |
Releases the connection without the option of keep-alive.
This is a "hard" release that implies a shutdown of the connection.
Use releaseConnection
for a graceful release.
IOException |
---|
TODO: The name of this method is misnomer. It will be renamed to
#finish() in the next major release.
This method is called to indicate that the content of this entity
is no longer required. All entity implementations are expected to
release all allocated resources as a result of this method
invocation. Content streaming entities are also expected to
dispose of the remaining content, if any. Wrapping entities should
delegate this call to the wrapped entity.
This method is of particular importance for entities being
received from a connection
. The entity
needs to be consumed completely in order to re-use the connection
with keep-alive.
IOException |
---|
Indicates that EOF is detected.
wrapped | the underlying stream which has reached EOF |
---|
true
if wrapped
should be closed,
false
if it should be left aloneIOException |
---|
Creates a new InputStream object of the entity.
It is a programming error
to return the same InputStream object more than once.
Entities that are not repeatable
will throw an exception if this method is called multiple times.
IOException |
---|
Tells if the entity is capable to produce its data more than once. A repeatable entity's getContent() and writeTo(OutputStream) methods can be called more than once whereas a non-repeatable entity's can not.
Releases the connection with the option of keep-alive. This is a
"graceful" release and may cause IO operations for consuming the
remainder of a response entity. Use
abortConnection
for a hard release. The
connection may be reused as specified by the duration.
IOException |
---|
Indicates that the stream
is aborted.
This method will be called only if EOF was not detected
before aborting. Otherwise, eofDetected
is called.
wrapped | the underlying stream which has not reached EOF |
---|
true
if wrapped
should be closed,
false
if it should be left aloneIOException |
---|
Indicates that the stream
is closed.
This method will be called only if EOF was not detected
before closing. Otherwise, eofDetected
is called.
wrapped | the underlying stream which has not reached EOF |
---|
true
if wrapped
should be closed,
false
if it should be left aloneIOException |
---|
Writes the entity content to the output stream.
outstream | the output stream to write entity content to |
---|
IOException |
---|
Releases the connection gracefully. The connection attribute will be nullified. Subsequent invocations are no-ops.
IOException | in case of an IO problem. The connection attribute will be nullified anyway. |
---|