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
. AManagedClientConnection
will 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 boolean
attemptReuse
Deprecated.Whether to keep the connection alive.protected ManagedClientConnection
managedConn
Deprecated.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 void
abortConnection()
Deprecated.Releases the connection without the option of keep-alive.void
consumeContent()
Deprecated.(4.1) UseEntityUtils.consume(HttpEntity)
private void
ensureConsumed()
Deprecated.boolean
eofDetected(java.io.InputStream wrapped)
Deprecated.Indicates that EOF is detected.java.io.InputStream
getContent()
Deprecated.boolean
isRepeatable()
Deprecated.void
releaseConnection()
Deprecated.Releases the connection with the option of keep-alive.protected void
releaseManagedConnection()
Deprecated.Releases the connection gracefully.boolean
streamAbort(java.io.InputStream wrapped)
Deprecated.Indicates that thestream
is aborted.boolean
streamClosed(java.io.InputStream wrapped)
Deprecated.Indicates that thestream
is closed.void
writeTo(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:
isRepeatable
in interfaceorg.apache.http.HttpEntity
- Overrides:
isRepeatable
in classorg.apache.http.entity.HttpEntityWrapper
-
getContent
public java.io.InputStream getContent() throws java.io.IOException
Deprecated.- Specified by:
getContent
in interfaceorg.apache.http.HttpEntity
- Overrides:
getContent
in classorg.apache.http.entity.HttpEntityWrapper
- Throws:
java.io.IOException
-
ensureConsumed
private void ensureConsumed() throws java.io.IOException
Deprecated.- Throws:
java.io.IOException
-
consumeContent
@Deprecated public void consumeContent() throws java.io.IOException
Deprecated.(4.1) UseEntityUtils.consume(HttpEntity)
- Specified by:
consumeContent
in interfaceorg.apache.http.HttpEntity
- Overrides:
consumeContent
in classorg.apache.http.entity.HttpEntityWrapper
- Throws:
java.io.IOException
-
writeTo
public void writeTo(java.io.OutputStream outStream) throws java.io.IOException
Deprecated.- Specified by:
writeTo
in interfaceorg.apache.http.HttpEntity
- Overrides:
writeTo
in classorg.apache.http.entity.HttpEntityWrapper
- Throws:
java.io.IOException
-
releaseConnection
public void releaseConnection() throws java.io.IOException
Deprecated.Description copied from interface:ConnectionReleaseTrigger
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. UseabortConnection
for a hard release. The connection may be reused as specified by the duration.- Specified by:
releaseConnection
in interfaceConnectionReleaseTrigger
- Throws:
java.io.IOException
- in case of an IO problem. The connection will be released anyway.
-
abortConnection
public void abortConnection() throws java.io.IOException
Deprecated.Description copied from interface:ConnectionReleaseTrigger
Releases 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:
abortConnection
in 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.IOException
Deprecated.Description copied from interface:EofSensorWatcher
Indicates that EOF is detected.- Specified by:
eofDetected
in interfaceEofSensorWatcher
- Parameters:
wrapped
- the underlying stream which has reached EOF- Returns:
true
ifwrapped
should be closed,false
if 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 iffalse
was returned.
-
streamClosed
public boolean streamClosed(java.io.InputStream wrapped) throws java.io.IOException
Deprecated.Description copied from interface:EofSensorWatcher
Indicates that thestream
is closed. This method will be called only if EOF was not detected before closing. Otherwise,eofDetected
is called.- Specified by:
streamClosed
in interfaceEofSensorWatcher
- Parameters:
wrapped
- the underlying stream which has not reached EOF- Returns:
true
ifwrapped
should be closed,false
if 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 iffalse
was returned.
-
streamAbort
public boolean streamAbort(java.io.InputStream wrapped) throws java.io.IOException
Deprecated.Description copied from interface:EofSensorWatcher
Indicates that thestream
is aborted. This method will be called only if EOF was not detected before aborting. Otherwise,eofDetected
is 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:
streamAbort
in interfaceEofSensorWatcher
- Parameters:
wrapped
- the underlying stream which has not reached EOF- Returns:
true
ifwrapped
should be closed,false
if 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 iffalse
was returned.
-
releaseManagedConnection
protected void releaseManagedConnection() throws java.io.IOException
Deprecated.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.
-
-