dev@jsr311.java.net

Re: JSR311: Response isn't adequate

From: Bill Burke <bburke_at_redhat.com>
Date: Mon, 10 Mar 2008 11:19:56 -0400

Jerome Louvel wrote:
> Hi Marc,
>
>>> The StreamOutput injected interface that Marc proposed is
>> an option
>>> and is not forcing anything. On the other hand, not allowing
>>> OutputSTream access to the Resource class *is* enforcing a
>>> particular model.
>
> It *is* forcing the engine to expose its response outputstream, when it
> wasn't obliged to do so before.
>
> Just to support this special case, an engine has to adapt its whole HTTP/IO
> logic, preventing general/broader optimizations as discussed.
>

Not true. No it doesn't.

> For example, in our case (a Restlet based implementation) this isn't
> possible without some kind of buffering which is counter-productive for a
> streaming use case.
>
>> A compromise: include the StreamOutput interface but put a strong
>> warning in the javadoc that use of it will prevent a container from
>> optimizing IO and thread usage.
>
> -1
>
> Returning an InputStream should be sufficient for most streaming cases.
>
> Can someone provide a use case that must be supported by JAX-RS and that
> can't be achieved using an InputStream?
>

The major use case is usability. People will want to use simple output
streams.



-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com