Package org.apache.http.conn
Class BasicManagedEntity
- java.lang.Object
-
- org.apache.http.entity.HttpEntityWrapper
-
- org.apache.http.conn.BasicManagedEntity
-
- All Implemented Interfaces:
ConnectionReleaseTrigger,EofSensorWatcher,org.apache.http.HttpEntity
@Deprecated public class BasicManagedEntity extends org.apache.http.entity.HttpEntityWrapper implements ConnectionReleaseTrigger, EofSensorWatcher
Deprecated.(4.3) do not use.An entity that releases aconnection. AManagedClientConnectionwill typically not return a managed entity, but you can replace the unmanaged entity in the response with a managed one.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanattemptReuseDeprecated.Whether to keep the connection alive.protected ManagedClientConnectionmanagedConnDeprecated.The connection to release.
-
Constructor Summary
Constructors Constructor Description BasicManagedEntity(org.apache.http.HttpEntity entity, ManagedClientConnection conn, boolean reuse)Deprecated.Creates a new managed entity that can release a connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidabortConnection()Deprecated.Releases the connection without the option of keep-alive.voidconsumeContent()Deprecated.(4.1) UseEntityUtils.consume(HttpEntity)booleaneofDetected(java.io.InputStream wrapped)Deprecated.Indicates that EOF is detected.java.io.InputStreamgetContent()Deprecated.booleanisRepeatable()Deprecated.voidreleaseConnection()Deprecated.Releases the connection with the option of keep-alive.protected voidreleaseManagedConnection()Deprecated.Releases the connection gracefully.booleanstreamAbort(java.io.InputStream wrapped)Deprecated.Indicates that thestreamis aborted.booleanstreamClosed(java.io.InputStream wrapped)Deprecated.Indicates that thestreamis closed.voidwriteTo(java.io.OutputStream outStream)Deprecated.
-
-
-
Field Detail
-
managedConn
protected ManagedClientConnection managedConn
Deprecated.The connection to release.
-
attemptReuse
protected final boolean attemptReuse
Deprecated.Whether to keep the connection alive.
-
-
Constructor Detail
-
BasicManagedEntity
public BasicManagedEntity(org.apache.http.HttpEntity entity, ManagedClientConnection conn, boolean reuse)Deprecated.Creates a new managed entity that can release a connection.- Parameters:
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 releasereuse- whether the connection should be re-used
-
-
Method Detail
-
isRepeatable
public boolean isRepeatable()
Deprecated.- Specified by:
isRepeatablein interfaceorg.apache.http.HttpEntity- Overrides:
isRepeatablein classorg.apache.http.entity.HttpEntityWrapper
-
getContent
public java.io.InputStream getContent() throws java.io.IOExceptionDeprecated.- Specified by:
getContentin interfaceorg.apache.http.HttpEntity- Overrides:
getContentin classorg.apache.http.entity.HttpEntityWrapper- Throws:
java.io.IOException
-
consumeContent
@Deprecated public void consumeContent() throws java.io.IOExceptionDeprecated.(4.1) UseEntityUtils.consume(HttpEntity)- Specified by:
consumeContentin interfaceorg.apache.http.HttpEntity- Overrides:
consumeContentin classorg.apache.http.entity.HttpEntityWrapper- Throws:
java.io.IOException
-
writeTo
public void writeTo(java.io.OutputStream outStream) throws java.io.IOExceptionDeprecated.- Specified by:
writeToin interfaceorg.apache.http.HttpEntity- Overrides:
writeToin classorg.apache.http.entity.HttpEntityWrapper- Throws:
java.io.IOException
-
releaseConnection
public void releaseConnection() throws java.io.IOExceptionDeprecated.Description copied from interface:ConnectionReleaseTriggerReleases 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. UseabortConnectionfor a hard release. The connection may be reused as specified by the duration.- Specified by:
releaseConnectionin interfaceConnectionReleaseTrigger- Throws:
java.io.IOException- in case of an IO problem. The connection will be released anyway.
-
abortConnection
public void abortConnection() throws java.io.IOExceptionDeprecated.Description copied from interface:ConnectionReleaseTriggerReleases the connection without the option of keep-alive. This is a "hard" release that implies a shutdown of the connection. UseConnectionReleaseTrigger.releaseConnection()for a graceful release.- Specified by:
abortConnectionin interfaceConnectionReleaseTrigger- Throws:
java.io.IOException- in case of an IO problem. The connection will be released anyway.
-
eofDetected
public boolean eofDetected(java.io.InputStream wrapped) throws java.io.IOExceptionDeprecated.Description copied from interface:EofSensorWatcherIndicates that EOF is detected.- Specified by:
eofDetectedin interfaceEofSensorWatcher- Parameters:
wrapped- the underlying stream which has reached EOF- Returns:
trueifwrappedshould be closed,falseif it should be left alone- Throws:
java.io.IOException- in case of an IO problem, for example if the watcher itself closes the underlying stream. The caller will leave the wrapped stream alone, as iffalsewas returned.
-
streamClosed
public boolean streamClosed(java.io.InputStream wrapped) throws java.io.IOExceptionDeprecated.Description copied from interface:EofSensorWatcherIndicates that thestreamis closed. This method will be called only if EOF was not detected before closing. Otherwise,eofDetectedis called.- Specified by:
streamClosedin interfaceEofSensorWatcher- Parameters:
wrapped- the underlying stream which has not reached EOF- Returns:
trueifwrappedshould be closed,falseif it should be left alone- Throws:
java.io.IOException- in case of an IO problem, for example if the watcher itself closes the underlying stream. The caller will leave the wrapped stream alone, as iffalsewas returned.
-
streamAbort
public boolean streamAbort(java.io.InputStream wrapped) throws java.io.IOExceptionDeprecated.Description copied from interface:EofSensorWatcherIndicates that thestreamis aborted. This method will be called only if EOF was not detected before aborting. Otherwise,eofDetectedis called.This method will also be invoked when an input operation causes an IOException to be thrown to make sure the input stream gets shut down.
- Specified by:
streamAbortin interfaceEofSensorWatcher- Parameters:
wrapped- the underlying stream which has not reached EOF- Returns:
trueifwrappedshould be closed,falseif it should be left alone- Throws:
java.io.IOException- in case of an IO problem, for example if the watcher itself closes the underlying stream. The caller will leave the wrapped stream alone, as iffalsewas returned.
-
releaseManagedConnection
protected void releaseManagedConnection() throws java.io.IOExceptionDeprecated.Releases the connection gracefully. The connection attribute will be nullified. Subsequent invocations are no-ops.- Throws:
java.io.IOException- in case of an IO problem. The connection attribute will be nullified anyway.
-
-