Package com.luna.common.net.async
Class CustomResponseConsumer
java.lang.Object
org.apache.hc.core5.http.nio.support.AbstractAsyncResponseConsumer<CustomAsyncHttpResponse,byte[]>
com.luna.common.net.async.CustomResponseConsumer
- All Implemented Interfaces:
org.apache.hc.core5.http.nio.AsyncDataConsumer,org.apache.hc.core5.http.nio.AsyncResponseConsumer<CustomAsyncHttpResponse>,org.apache.hc.core5.http.nio.ResourceHolder
public final class CustomResponseConsumer
extends org.apache.hc.core5.http.nio.support.AbstractAsyncResponseConsumer<CustomAsyncHttpResponse,byte[]>
HTTP response consumer that generates a
CustomAsyncHttpResponse instance based on events
of an incoming data stream.
IMPORTANT: CustomAsyncHttpResponses are intended for simple scenarios where entities inclosed
in responses are known to be small. It is generally recommended to use streaming
AsyncResponseConsumers, for instance, such as based on
AbstractCharResponseConsumer or AbstractBinResponseConsumer.
- Since:
- 5.0
- See Also:
-
SimpleBodyCustomAsyncHttpResponseAbstractCharResponseConsumerAbstractBinResponseConsumer
-
Constructor Summary
ConstructorsConstructorDescriptionCustomResponseConsumer(org.apache.hc.core5.function.Supplier<org.apache.hc.core5.http.nio.AsyncEntityConsumer<byte[]>> dataConsumerSupplier) -
Method Summary
Modifier and TypeMethodDescriptionprotected CustomAsyncHttpResponsebuildResult(org.apache.hc.core5.http.HttpResponse response, byte[] entity, org.apache.hc.core5.http.ContentType contentType) static CustomResponseConsumercreate()voidinformationResponse(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
-
CustomResponseConsumer
public CustomResponseConsumer(org.apache.hc.core5.function.Supplier<org.apache.hc.core5.http.nio.AsyncEntityConsumer<byte[]>> dataConsumerSupplier)
-
-
Method Details
-
create
-
informationResponse
public void informationResponse(org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.protocol.HttpContext context) -
buildResult
protected CustomAsyncHttpResponse buildResult(org.apache.hc.core5.http.HttpResponse response, byte[] entity, org.apache.hc.core5.http.ContentType contentType) - Specified by:
buildResultin classorg.apache.hc.core5.http.nio.support.AbstractAsyncResponseConsumer<CustomAsyncHttpResponse,byte[]>
-