Hello Jon,

from what I notice, this is due to the fact that the entity is not
consumed. I've just reproduced it using this code:
        ClientResource cr = new
ClientResource("http://www.example.com";);

        for (int i = 0; i < 20; i++) {
            System.out.println(i);
            cr.get();
        }

After thinking more to your suggestion, I think there would be cases where
errors responses (404, or authentication errors), contain valuable
entities, that the client code would like to consume. Then I think we can't
factorise the code and just abort the connection in all cases.
I wonder if in your case, it is easier to add a "cr.release();" call which
takes care of "closing" the connection, just as you tried. As it must work
properly, and because I didn't reproduced this issue, could you provide a
sample test case?

Regarding the handling of exceptions, we have to think about it. The idea
is that this common code should handle properly exceptions issued from the
HttpClient apache library. I keep the issue open.
Please feel free to add any comment!

Best regards,
Thierry Boileau

Thierry,
>
> I have come up with a "fix" that solves the issue for us... but I don't
> know if it is the best/right solution.  It doesn't seem to be the right way
> to handle it.
>
>
> I'm using the 2.0.11 source.
>
> In HttpMethodCall.sendRequest(Request) I noticed that after:
>
>     this.httpResponse = this.clientHelper.getHttpClient().execute(
>                     getHttpRequest());
>
> when catching the exception they do this:
>
>             // Release the connection
>             getHttpRequest().abort();
>
> So in the non-exception case I added a test:
>
>             if (result.isError()) {
>                 getHttpRequest().abort();
>             }
>
> It seems odd to me that this code should have to know to abort the request
> in these error & exception cases, but not in the successful case.  I also
> wonder if there are other exceptions (e.g. ClientProtocolException) that
> should be caught and handled similarly.
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2994842
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2998412

Reply via email to