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 TypeMethodDescriptionvoid
close()
void
consumeContent
(ContentDecoder decoder, IOControl ioControl) Invoked to process a chunk of content from theContentDecoder
.void
Invoked 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.boolean
isDone()
Determines whether or not the request execution completed.void
requestCompleted
(HttpContext context) Invoked to signal that the request has been fully processed.void
requestReceived
(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:HttpAsyncRequestConsumer
Invoked when a HTTP request message is received. Please note that theHttpAsyncRequestConsumer.consumeContent(ContentDecoder, IOControl)
method will be invoked only for if the request message implementsHttpEntityEnclosingRequest
interface and has a content entity enclosed.- Specified by:
requestReceived
in interfaceHttpAsyncRequestConsumer<Object>
- Parameters:
request
- HTTP request message.
-
consumeContent
Description copied from interface:HttpAsyncRequestConsumer
Invoked to process a chunk of content from theContentDecoder
. TheIOControl
interface 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
ContentDecoder
object is not thread-safe and should only be used within the context of this method call. TheIOControl
object can be shared and used on other thread to resume input event notifications when the consumer is capable of processing more content.- Specified by:
consumeContent
in 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:HttpAsyncRequestConsumer
Invoked to signal that the request has been fully processed.- Specified by:
requestCompleted
in interfaceHttpAsyncRequestConsumer<Object>
- Parameters:
context
- HTTP context
-
failed
Description copied from interface:HttpAsyncRequestConsumer
Invoked to signal that the request processing terminated abnormally.- Specified by:
failed
in interfaceHttpAsyncRequestConsumer<Object>
- Parameters:
ex
- exception
-
getResult
Description copied from interface:HttpAsyncRequestConsumer
Returns a result of the request execution, when available. This method returnsnull
if the request execution is still ongoing.- Specified by:
getResult
in interfaceHttpAsyncRequestConsumer<Object>
- See Also:
-
getException
Description copied from interface:HttpAsyncRequestConsumer
Returns an exception in case of an abnormal termination. This method returnsnull
if the request execution is still ongoing or if it completed successfully.- Specified by:
getException
in interfaceHttpAsyncRequestConsumer<Object>
- See Also:
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
isDone
public boolean isDone()Description copied from interface:HttpAsyncRequestConsumer
Determines 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:
isDone
in interfaceHttpAsyncRequestConsumer<Object>
-