Http client API (original) (raw)
Chris Hegarty chris.hegarty at oracle.com
Wed Aug 8 13:50:23 PDT 2012
- Previous message: Http client API
- Next message: Http client API
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Oh, my head hurts! ;-) There are already three setBody methods.
I agree, a boolean like this can be confusing. A setBodyRestartable(Itr), and setBodyNonRestarable(Itr) may be a possible solution here. But ( what I think you are suggesting too ), Iterable implementations should do the right thing, they should always be "restartable".
Maybe/Simply remove the restartable boolean param and put a note in the spec that Iterable implementations that for whatever reason cannot be restarted should perform some kind of caching. So we only support "honest" Iterables.
Unless I'm missing some valid use-case that demands this non-restartable API.
-Chris.
On 08/08/12 20:09, Ian Robertston wrote:
Instead of HttpRequest having
void setBody(Iterable buffers, boolean isRestartable) what about having two methods: void setBody(Iterable buffers) // presumed restartable void setBody(Iterator buffers) // clearly not restartable Not only does this avoid a potentially confusing boolean parameter, but it also avoids forcing people to create "dishonest" Iterables, where they know the iterator() method cannot be called more than once. - Ian
- Previous message: Http client API
- Next message: Http client API
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]