Please extend AbstractAsyncResponseConsumer instead
----
public class MyResponseConsumer extends
AbstractAsyncResponseConsumer<SimpleHttpResponse, byte[]> {
MyResponseConsumer(final AsyncEntityConsumer<byte[]> entityConsumer) {
super(entityConsumer);
}
public static SimpleResponseConsumer create() {
return new SimpleResponseConsumer(new SimpleAsyncEntityConsumer());
}
@Override
public void informationResponse(final HttpResponse response, final
HttpContext context) throws HttpException, IOException {
}
@Override
protected SimpleHttpResponse buildResult(final HttpResponse response, final
byte[] entity, final ContentType contentType) {
final SimpleHttpResponse simpleResponse =
SimpleHttpResponse.copy(response);
if (entity != null) {
simpleResponse.setBody(entity, contentType);
}
return simpleResponse;
}
}
On Thu, 2022-03-17 at 14:26 +0100, Christophe Darville wrote:
> Hi,
>
> In HttpClient5, the class
> org.apache.hc.client5.http.async.methods.SimpleResponseConsumer is
> final. Would it be possible to make this class not final ? I would
> like to extend it so I can override the buildResult method.
>
> Regards,
> Christophe
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]