I just wanted to use SimpleAsyncEntityConsumer to avoid to create my own class 
that will do basically the same job. But it is ok, I will create my own 
“SimpleAsyncEntityConsumer” 

Regards,
Christophe

> On 17 Mar 2022, at 17:41, Oleg Kalnichevski <ol...@apache.org> wrote:
> 
> On Thu, 2022-03-17 at 17:23 +0100, Christophe Darville wrote:
>> Hi Oleg,
>> 
>> Thank you for your answer. Before sending my post, I first tried to
>> extends AbstractAsyncResponseConsumer like in your sample code but
>> unfortunately the class SimpleAsyncEntityConsumer used in create() is
>> not public and I cannot take advantage of that class. This is why, in
>> my case, extending SimpleResponseConsumer would do the trick (or
>> making SimpleAsyncEntityConsumer public …)
>> 
>> Regards,
>> Christophe
> 
> I am not sure I understand the problem.
> Use AbstractBinAsyncEntityConsumer or
> AbstractCharAsyncEntityConsumer instead. 
> 
> Simple* class variety are effectively internal I do not want to open
> them up. They are not supposed to be used in real productive code.
> 
> Oleg 
> 
> 
>> 
>>> On 17 Mar 2022, at 16:56, Oleg Kalnichevski <ol...@apache.org>
>>> wrote:
>>> 
>>> 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: 
>>>> httpclient-users-unsubscr...@hc.apache.org
>>>> For additional commands, e-mail: 
>>>> httpclient-users-h...@hc.apache.org
>>>> 
>>> 
>>> -----------------------------------------------------------------
>>> ----
>>> To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
>>> For additional commands, e-mail: 
>>> httpclient-users-h...@hc.apache.org
>>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
> For additional commands, e-mail: httpclient-users-h...@hc.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to