Package org.apache.http.nio.protocol
Class NullRequestConsumer
java.lang.Object
org.apache.http.nio.protocol.NullRequestConsumer
- All Implemented Interfaces:
Closeable,AutoCloseable,HttpAsyncRequestConsumer<Object>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidconsumeContent(ContentDecoder decoder, IOControl ioControl) Invoked to process a chunk of content from theContentDecoder.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.voidrequestCompleted(HttpContext context) Invoked to signal that the request has been fully processed.voidrequestReceived(HttpRequest request) Invoked when a HTTP request message is received.
-
Field Details
-
buffer
-
completed
private volatile boolean completed
-
-
Constructor Details
-
NullRequestConsumer
NullRequestConsumer()
-
-
Method Details
-
requestReceived
Description copied from interface:HttpAsyncRequestConsumerInvoked when a HTTP request message is received. Please note that theHttpAsyncRequestConsumer.consumeContent(ContentDecoder, IOControl)method will be invoked only for if the request message implementsHttpEntityEnclosingRequestinterface and has a content entity enclosed.- Specified by:
requestReceivedin interfaceHttpAsyncRequestConsumer<Object>- Parameters:
request- HTTP request message.
-
consumeContent
Description copied from interface:HttpAsyncRequestConsumerInvoked to process a chunk of content from theContentDecoder. TheIOControlinterface can be used to suspend input event notifications if the consumer is temporarily unable to process content.The consumer can use the
ContentDecoder.isCompleted()method to find out whether or not the message content has been fully consumed.Please note that the
ContentDecoderobject is not thread-safe and should only be used within the context of this method call. TheIOControlobject can be shared and used on other thread to resume input event notifications when the consumer is capable of processing more content.- Specified by:
consumeContentin interfaceHttpAsyncRequestConsumer<Object>- Parameters:
decoder- content decoder.ioControl- I/O control of the underlying connection.- Throws:
IOException- in case of an I/O error
-
requestCompleted
Description copied from interface:HttpAsyncRequestConsumerInvoked to signal that the request has been fully processed.- Specified by:
requestCompletedin interfaceHttpAsyncRequestConsumer<Object>- Parameters:
context- HTTP context
-
failed
Description copied from interface:HttpAsyncRequestConsumerInvoked to signal that the request processing terminated abnormally.- Specified by:
failedin interfaceHttpAsyncRequestConsumer<Object>- Parameters:
ex- exception
-
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<Object>- See Also:
-
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<Object>- See Also:
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
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<Object>
-