RE: JSR311: Response isn't adequate

From: Jerome Louvel <>
Date: Mon, 10 Mar 2008 15:28:15 +0100

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.

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.


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?

Best regards,