Package org.apache.http.nio.protocol
Class AbstractAsyncRequestConsumer<T>
java.lang.Object
org.apache.http.nio.protocol.AbstractAsyncRequestConsumer<T>
- All Implemented Interfaces:
Closeable,AutoCloseable,HttpAsyncRequestConsumer<T>
- Direct Known Subclasses:
BasicAsyncRequestConsumer
public abstract class AbstractAsyncRequestConsumer<T>
extends Object
implements HttpAsyncRequestConsumer<T>
Abstract
HttpAsyncRequestConsumer implementation that relieves its
subclasses from having to manage internal state and provides a number of protected
event methods that they need to implement.- Since:
- 4.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclose()final voidconsumeContent(ContentDecoder decoder, IOControl ioctrl) UseonContentReceived(ContentDecoder, IOControl)instead.final voidInvoked to signal that the request processing terminated abnormally.Returns an exception in case of an abnormal termination.Returns a result of the request execution, when available.booleanisDone()Determines whether or not the request execution completed.final voidrequestCompleted(HttpContext context) UsebuildResult(HttpContext)instead.final voidrequestReceived(HttpRequest request) UseonRequestReceived(HttpRequest)instead.
-
Constructor Details
-
AbstractAsyncRequestConsumer
public AbstractAsyncRequestConsumer()
-
-
Method Details
-
requestReceived
UseonRequestReceived(HttpRequest)instead.- Specified by:
requestReceivedin interfaceHttpAsyncRequestConsumer<T>- Parameters:
request- HTTP request message.- Throws:
HttpException- in case of HTTP protocol violationIOException- in case of an I/O error
-
consumeContent
UseonContentReceived(ContentDecoder, IOControl)instead.- Specified by:
consumeContentin interfaceHttpAsyncRequestConsumer<T>- Parameters:
decoder- content decoder.ioctrl- I/O control of the underlying connection.- Throws:
IOException- in case of an I/O error
-
requestCompleted
UsebuildResult(HttpContext)instead.- Specified by:
requestCompletedin interfaceHttpAsyncRequestConsumer<T>- Parameters:
context- HTTP context
-
failed
Description copied from interface:HttpAsyncRequestConsumerInvoked to signal that the request processing terminated abnormally.- Specified by:
failedin interfaceHttpAsyncRequestConsumer<T>- Parameters:
ex- exception
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getException
Description copied from interface:HttpAsyncRequestConsumerReturns an exception in case of an abnormal termination. This method returnsnullif the request execution is still ongoing or if it completed successfully.- Specified by:
getExceptionin interfaceHttpAsyncRequestConsumer<T>- See Also:
-
getResult
Description copied from interface:HttpAsyncRequestConsumerReturns a result of the request execution, when available. This method returnsnullif the request execution is still ongoing.- Specified by:
getResultin interfaceHttpAsyncRequestConsumer<T>- See Also:
-
isDone
public boolean isDone()Description copied from interface:HttpAsyncRequestConsumerDetermines whether or not the request execution completed. If the request processing terminated normallyHttpAsyncRequestConsumer.getResult()can be used to obtain the result. If the request processing terminated abnormallyHttpAsyncRequestConsumer.getException()can be used to obtain the cause.- Specified by:
isDonein interfaceHttpAsyncRequestConsumer<T>
-