On Tue, 2019-10-22 at 16:17 +0200, Michael Osipov wrote: > Folks, > > I am currently working on WAGON-568 and would like better understand > how > HttpEntity#isReproducible() should be properly handled. > > In AbstractHttpClientWagon#put() [1] on specific status codes the > request (PUT) is retried manually with the same HttpEntity [2] > without: > > * consuming the given response entity, > * calling fireTransferError() (Wagon internal), > * knowing that the entity is repeatable > > This may apply if expect/continue did not work properly. > > From what I understand, this approach is broken. I have either to > fix > the above or employ a modified version of DefaultRedirectStrategy. > > Is my understanding correct? >
Hi Michael No, I do not think your current approach is wrong. The contract of HttpEntity is such that if HttpEntity#isRepeatable returns true the HttpEntity#writeTo method is expected to produce the same entity representation upon each invocation. HttpClient should be able to automatically re-try the request without any intervention as long as the HttpEntity contract is correctly implemented. > Anyway, I have always signal an exception when a already consumed > request body cannot be replayed?! > HttpClient automatically throws NonRepeatableRequestException if a method re-execution is impossible due to the closed entity being non- repeatable. I do not think Wagon needs to provide any additional handling logic unless there are some Wagon specific requirements I am not aware of. Hope this helps. Oleg > Michael > > [1] > https://github.com/apache/maven-wagon/blob/master/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java#L674 > [2] > https://github.com/apache/maven-wagon/blob/master/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java#L739-L743 > > --------------------------------------------------------------------- > 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