Package ai.preferred.venom.fetcher
Class AsyncResponseConsumer
- java.lang.Object
-
- org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<Response>
-
- ai.preferred.venom.fetcher.AsyncResponseConsumer
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,org.apache.http.concurrent.Cancellable
,org.apache.http.nio.protocol.HttpAsyncResponseConsumer<Response>
public class AsyncResponseConsumer extends org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<Response>
On top of the abstract class, this class handles the parsing of a response from the web service.- Author:
- Ween Jiann Lee
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BaseResponse
buildResult(org.apache.http.protocol.HttpContext context)
protected org.apache.http.entity.ContentType
getContentType(org.apache.http.HttpEntity entity)
protected void
onContentReceived(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioctrl)
protected void
onEntityEnclosed(org.apache.http.HttpEntity entity, org.apache.http.entity.ContentType contentType)
protected void
onResponseReceived(org.apache.http.HttpResponse httpResponse)
protected void
releaseResources()
-
-
-
Method Detail
-
getContentType
protected final org.apache.http.entity.ContentType getContentType(org.apache.http.HttpEntity entity)
- Overrides:
getContentType
in classorg.apache.http.nio.protocol.AbstractAsyncResponseConsumer<Response>
-
onResponseReceived
protected final void onResponseReceived(org.apache.http.HttpResponse httpResponse)
- Specified by:
onResponseReceived
in classorg.apache.http.nio.protocol.AbstractAsyncResponseConsumer<Response>
-
onContentReceived
protected final void onContentReceived(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioctrl) throws java.io.IOException
- Specified by:
onContentReceived
in classorg.apache.http.nio.protocol.AbstractAsyncResponseConsumer<Response>
- Throws:
java.io.IOException
-
onEntityEnclosed
protected final void onEntityEnclosed(org.apache.http.HttpEntity entity, org.apache.http.entity.ContentType contentType) throws java.io.IOException
- Specified by:
onEntityEnclosed
in classorg.apache.http.nio.protocol.AbstractAsyncResponseConsumer<Response>
- Throws:
java.io.IOException
-
buildResult
protected final BaseResponse buildResult(org.apache.http.protocol.HttpContext context) throws java.lang.Exception
- Specified by:
buildResult
in classorg.apache.http.nio.protocol.AbstractAsyncResponseConsumer<Response>
- Throws:
java.lang.Exception
-
releaseResources
protected final void releaseResources()
- Specified by:
releaseResources
in classorg.apache.http.nio.protocol.AbstractAsyncResponseConsumer<Response>
-
-