dev@jsr311.java.net

Re: JSR311: Response isn't adequate

From: Bill Burke <bburke_at_redhat.com>
Date: Fri, 07 Mar 2008 15:51:45 -0500

Marc Hadley wrote:
> On Mar 7, 2008, at 10:53 AM, Bill Burke wrote:
>>
>>>> I don't think getting access to Input/OutputStreams creates a
>>>> suboptimal design. Since a JAX-RS endpoint uses annotations rather
>>>> than a static interface contract to process requests, its easy to
>>>> plug in new models as they become available through the
>>>> specification or as vendor plugins. The key is to get the extension
>>>> SPIs correct.
>>> Again, returning an InputStream is fine and optimal. My issue is with
>>> giving
>>> a direct access to Response's OutputStream is that it forces
>>> thread-per-request model and prevents optimization in the HTTP/IO
>>> layers.
>>
>> 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.
>>
> 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.

Also, can consider a simple Representation interface? I know it would
be easy to implement one with the @Provider model, but I think its a
good idea.

Bill

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