hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Posting with non-repeatable entity
Date Thu, 21 Feb 2013 22:08:19 GMT
On Thu, 2013-02-21 at 21:14 +0100, Roman Kennke wrote:
> Hello,
> 
> I am trying to post a multipart entity body using MultipartEntity. I
> need to use an InputStreamBody, which is non-repeatable (because its
> getContentLength() returns -1). However, I get an exception in
> DefaultRequestDirector.tryExecute(). The first thing that happens in
> this loop is that it checks if the entity is repeatable, and if not, it
> throws an exception, even though it hasn't even tried once.
> 
> http://fpaste.org/J1Nm/
> 
> When I get there, retryReason is still null, and I end up getting the
> 2nd exception thrown. This seems bogus to me. There should not be an
> else-branch and it should try at least once. Or am I totally missing
> something here?
> 
> Roman
> 

Roman

This may be non-obvious but request repeatability is determined by the
request wrapper that keeps track of whether or not the request entity
has been consumed (at least once).

See EntityEnclosingRequestWrapper#isRepeatable() implementation

http://hc.apache.org/httpcomponents-client-ga/httpclient/xref/org/apache/http/impl/client/EntityEnclosingRequestWrapper.html#81

Hope this helps

Oleg



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


Mime
View raw message