Package org.apache.http.impl.execchain
Class ResponseEntityProxy
- java.lang.Object
-
- org.apache.http.entity.HttpEntityWrapper
-
- org.apache.http.impl.execchain.ResponseEntityProxy
-
- All Implemented Interfaces:
EofSensorWatcher,org.apache.http.HttpEntity
class ResponseEntityProxy extends org.apache.http.entity.HttpEntityWrapper implements EofSensorWatcher
A wrapper class forHttpEntityenclosed in a response message.- Since:
- 4.3
-
-
Field Summary
Fields Modifier and Type Field Description private ConnectionHolderconnHolder
-
Constructor Summary
Constructors Constructor Description ResponseEntityProxy(org.apache.http.HttpEntity entity, ConnectionHolder connHolder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidabortConnection()private voidcleanup()voidconsumeContent()static voidenchance(org.apache.http.HttpResponse response, ConnectionHolder connHolder)booleaneofDetected(java.io.InputStream wrapped)Indicates that EOF is detected.java.io.InputStreamgetContent()booleanisRepeatable()voidreleaseConnection()booleanstreamAbort(java.io.InputStream wrapped)Indicates that thestreamis aborted.booleanstreamClosed(java.io.InputStream wrapped)Indicates that thestreamis closed.java.lang.StringtoString()voidwriteTo(java.io.OutputStream outStream)
-
-
-
Field Detail
-
connHolder
private final ConnectionHolder connHolder
-
-
Constructor Detail
-
ResponseEntityProxy
ResponseEntityProxy(org.apache.http.HttpEntity entity, ConnectionHolder connHolder)
-
-
Method Detail
-
enchance
public static void enchance(org.apache.http.HttpResponse response, ConnectionHolder connHolder)
-
cleanup
private void cleanup() throws java.io.IOException- Throws:
java.io.IOException
-
abortConnection
private void abortConnection()
-
releaseConnection
public void releaseConnection()
-
isRepeatable
public boolean isRepeatable()
- Specified by:
isRepeatablein interfaceorg.apache.http.HttpEntity- Overrides:
isRepeatablein classorg.apache.http.entity.HttpEntityWrapper
-
getContent
public java.io.InputStream getContent() throws java.io.IOException- Specified by:
getContentin interfaceorg.apache.http.HttpEntity- Overrides:
getContentin classorg.apache.http.entity.HttpEntityWrapper- Throws:
java.io.IOException
-
consumeContent
public void consumeContent() throws java.io.IOException- 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.IOException- Specified by:
writeToin interfaceorg.apache.http.HttpEntity- Overrides:
writeToin classorg.apache.http.entity.HttpEntityWrapper- Throws:
java.io.IOException
-
eofDetected
public boolean eofDetected(java.io.InputStream wrapped) throws java.io.IOExceptionDescription 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.IOExceptionDescription 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.IOExceptionDescription 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.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-