On Thu, 2013-02-21 at 23:27 +0100, Roman Kennke wrote:
> Am Donnerstag, den 21.02.2013, 23:08 +0100 schrieb Oleg Kalnichevski:
> > 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
> 
> Oh yeah, thanks, this helped. However, I now found out that the request
> is retried because of authentication. Is it possible to have
> authentication and not require to retry the request? The body is
> potentially large, even if I could wrap my InputStreamBody into a temp
> file and send this instead, I would really like to avoid sending the
> whole thing twice because of authentication. Any ideas?
> 

'Expect: continue' handshake is your best friend.

Oleg 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to