users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: Response.readEntity contract does not allow streaming

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Thu, 5 Sep 2013 11:14:25 +0200

Hi Sergey,

Sorry for a long delay in responding. Good catch, please file a bug against 2.0 (if you did not file one yet).

Thanks,
Marek
On Aug 2, 2013, at 10:34 PM, Sergey Beryozkin <sberyozkin_at_talend.com> wrote:

> Hi
>
> The sentence in Response.readEntity method,
>
> "Unless the supplied entity type is an input stream, this method automatically closes the an unconsumed original response entity data stream if open" breaks streaming completely, example:
>
> Source source = Response.readEntity(Source.class);
>
> Any Source implementation which does not buffer immediately becomes of no use. Lazy loading DOM Documents get broken. And 'fixing' it by buffering obviously defeats the purpose of streaming.
>
> IMHO we need to remove an auto-closing requirement from 2.1. This falls into an optional optimization area - meaning a JAX-RS property can fix it and Configuration instances can carry along such properties
>
> Cheers, Sergey