Class SimpleResponseConsumer
java.lang.Object
org.apache.hc.core5.http.nio.support.AbstractAsyncResponseConsumer<SimpleHttpResponse,byte[]>
org.apache.hc.client5.http.async.methods.SimpleResponseConsumer
- All Implemented Interfaces:
org.apache.hc.core5.http.nio.AsyncDataConsumer
,org.apache.hc.core5.http.nio.AsyncResponseConsumer<SimpleHttpResponse>
,org.apache.hc.core5.http.nio.ResourceHolder
public final class SimpleResponseConsumer
extends org.apache.hc.core5.http.nio.support.AbstractAsyncResponseConsumer<SimpleHttpResponse,byte[]>
HTTP response consumer that generates a
SimpleHttpResponse
instance based on events
of an incoming data stream.
IMPORTANT: SimpleHttpResponse
s are intended for simple scenarios where entities inclosed
in responses are known to be small. It is generally recommended to use streaming
AsyncResponseConsumer
s, for instance, such as based on
AbstractCharResponseConsumer
or AbstractBinResponseConsumer
.
- Since:
- 5.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleResponseConsumer
(org.apache.hc.core5.http.nio.AsyncEntityConsumer<byte[]> entityConsumer) -
Method Summary
Modifier and TypeMethodDescriptionprotected SimpleHttpResponse
buildResult
(org.apache.hc.core5.http.HttpResponse response, byte[] entity, org.apache.hc.core5.http.ContentType contentType) static SimpleResponseConsumer
create()
void
informationResponse
(org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.protocol.HttpContext context) Methods inherited from class org.apache.hc.core5.http.nio.support.AbstractAsyncResponseConsumer
consume, consumeResponse, failed, releaseResources, streamEnd, updateCapacity
-
Constructor Details
-
SimpleResponseConsumer
SimpleResponseConsumer(org.apache.hc.core5.http.nio.AsyncEntityConsumer<byte[]> entityConsumer)
-
-
Method Details
-
create
-
informationResponse
public void informationResponse(org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.protocol.HttpContext context) throws org.apache.hc.core5.http.HttpException, IOException - Throws:
org.apache.hc.core5.http.HttpException
IOException
-
buildResult
protected SimpleHttpResponse buildResult(org.apache.hc.core5.http.HttpResponse response, byte[] entity, org.apache.hc.core5.http.ContentType contentType) - Specified by:
buildResult
in classorg.apache.hc.core5.http.nio.support.AbstractAsyncResponseConsumer<SimpleHttpResponse,
byte[]>
-