hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Sutton <adr...@intencha.com>
Subject Re: InputStream part source
Date Thu, 17 Jul 2003 22:36:54 GMT
> In reading Adrian's recommendation, it sounds like I can't be 
> guaranteed that it will call createInputStream only once
> Does the two settings above guarantee that createInputStream will be 
> called only once, or should I adjust the InputStreamPartSource to 
> handle the case where HttpClient asks for the new stream more than 
> once?

You should definitely cater for the case where the stream needs to be 
created again.  The simplest design (generally, perhaps not for you) is 
to have the createInputStream actually create the input stream instead 
of just returning it.  This is particularly useful because it avoids 
creating the input stream altogether if the server can't be found or 
the request fails early for some other reason.

Having said that, for quite some time FilePart couldn't resend it's 
content without anyone noticing (true to murphy's law a client of mine 
hit the problem first), so there's a reasonable chance you'd get away 
without being able to resend.

The decision mostly comes down to what the consequences of failure are 
and how likely you are to have an authentication failure or some other 
error returned by the server (too busy, redirect, or any of a wide 
range of things that can cause the request to be resent).

> David Sean Taylor

Hope that helps,

Adrian Sutton.

Intencha "tomorrow's technology today"
Ph: 38478913 0422236329
Suite 8/29 Oatland Crescent
Holland Park West 4121
Australia QLD

View raw message