class NullRequestConsumer extends Object implements HttpAsyncRequestConsumer<Object>
Modifier and Type | Field and Description |
---|---|
private ByteBuffer |
buffer |
private boolean |
completed |
Constructor and Description |
---|
NullRequestConsumer() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
consumeContent(ContentDecoder decoder,
IOControl ioctrl)
Invoked to process a chunk of content from the
ContentDecoder . |
void |
failed(Exception ex)
Invoked to signal that the request processing terminated abnormally.
|
Exception |
getException()
Returns an exception in case of an abnormal termination.
|
Object |
getResult()
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.
|
private final ByteBuffer buffer
private volatile boolean completed
NullRequestConsumer()
public void requestReceived(HttpRequest request)
HttpAsyncRequestConsumer
HttpAsyncRequestConsumer.consumeContent(ContentDecoder, IOControl)
method
will be invoked only for if the request message implements
HttpEntityEnclosingRequest
interface and
has a content entity enclosed.requestReceived
in interface HttpAsyncRequestConsumer<Object>
request
- HTTP request message.public void consumeContent(ContentDecoder decoder, IOControl ioctrl) throws IOException
HttpAsyncRequestConsumer
ContentDecoder
.
The IOControl
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.
The IOControl
object can be shared and used on other thread
to resume input event notifications when the consumer is capable of
processing more content.
consumeContent
in interface HttpAsyncRequestConsumer<Object>
decoder
- content decoder.ioctrl
- I/O control of the underlying connection.IOException
- in case of an I/O errorpublic void requestCompleted(HttpContext context)
HttpAsyncRequestConsumer
requestCompleted
in interface HttpAsyncRequestConsumer<Object>
context
- HTTP contextpublic void failed(Exception ex)
HttpAsyncRequestConsumer
failed
in interface HttpAsyncRequestConsumer<Object>
ex
- exceptionpublic Object getResult()
HttpAsyncRequestConsumer
null
if the request execution is still ongoing.getResult
in interface HttpAsyncRequestConsumer<Object>
HttpAsyncRequestConsumer.isDone()
public Exception getException()
HttpAsyncRequestConsumer
null
if the request execution is still ongoing
or if it completed successfully.getException
in interface HttpAsyncRequestConsumer<Object>
HttpAsyncRequestConsumer.isDone()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public boolean isDone()
HttpAsyncRequestConsumer
HttpAsyncRequestConsumer.getResult()
can be used to obtain the result. If the request processing terminated
abnormally HttpAsyncRequestConsumer.getException()
can be used to obtain the cause.isDone
in interface HttpAsyncRequestConsumer<Object>
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses