public abstract class AbstractAsyncResponseConsumer<T> extends Object implements HttpAsyncResponseConsumer<T>
HttpAsyncResponseConsumer
implementation that relieves its
subclasses from having to manage internal state and provides a number of protected
event methods that they need to implement.Constructor and Description |
---|
AbstractAsyncResponseConsumer() |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel() |
void |
close() |
void |
consumeContent(ContentDecoder decoder,
IOControl ioctrl)
Use
onContentReceived(ContentDecoder, IOControl) instead. |
void |
failed(Exception ex)
Invoked to signal that the response processing terminated abnormally.
|
Exception |
getException()
Returns an exception in case of an abnormal termination.
|
T |
getResult()
Returns a result of the response processing, when available.
|
boolean |
isDone()
Determines whether or not the response processing completed.
|
void |
responseCompleted(HttpContext context)
Use
buildResult(HttpContext) instead. |
void |
responseReceived(HttpResponse response)
Use
onResponseReceived(HttpResponse) instead. |
public final void responseReceived(HttpResponse response) throws IOException, HttpException
onResponseReceived(HttpResponse)
instead.responseReceived
in interface HttpAsyncResponseConsumer<T>
response
- HTTP response message.IOException
- in case of an I/O errorHttpException
- in case of HTTP protocol violationpublic final void consumeContent(ContentDecoder decoder, IOControl ioctrl) throws IOException
onContentReceived(ContentDecoder, IOControl)
instead.consumeContent
in interface HttpAsyncResponseConsumer<T>
decoder
- content decoder.ioctrl
- I/O control of the underlying connection.IOException
- in case of an I/O errorpublic final void responseCompleted(HttpContext context)
buildResult(HttpContext)
instead.responseCompleted
in interface HttpAsyncResponseConsumer<T>
context
- HTTP contextpublic final boolean cancel()
cancel
in interface Cancellable
public final void failed(Exception ex)
HttpAsyncResponseConsumer
failed
in interface HttpAsyncResponseConsumer<T>
ex
- exceptionpublic final void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public Exception getException()
HttpAsyncResponseConsumer
null
if the response processing is still ongoing
or if it completed successfully.getException
in interface HttpAsyncResponseConsumer<T>
HttpAsyncResponseConsumer.isDone()
public T getResult()
HttpAsyncResponseConsumer
null
if the response processing is still ongoing.getResult
in interface HttpAsyncResponseConsumer<T>
HttpAsyncResponseConsumer.isDone()
public boolean isDone()
HttpAsyncResponseConsumer
HttpAsyncResponseConsumer.getResult()
can be used to obtain the result. If the response processing terminated
abnormally HttpAsyncResponseConsumer.getException()
can be used to obtain the cause.isDone
in interface HttpAsyncResponseConsumer<T>
Copyright © 2010 - 2020 Adobe. All Rights Reserved