On Mar 5, 2008, at 5:18 PM, Larry Cable wrote:
> Ah thanks for pointing that out Bill, I was getting confused by the
> optioms, +1 for r.getOuputStream()
>
I still don't like it. Currently ResponseBuilder and RuntimeDelegate
(the factory for ResponseBuilder instances) are both independent of
the request cycle. This would require RuntimeDelegate to be coupled
to a request somehow.
Marc.
> ________________________________
>
> From: Bill Burke [mailto:bburke_at_redhat.com]
> Sent: Wed 3/5/2008 11:31 AM
> To: dev_at_jsr311.dev.java.net
> Subject: Re: JSR311: Response isn't adequate
>
>
>
>
>
> Marc Hadley wrote:
>> On Mar 5, 2008, at 1:12 PM, Marc Hadley wrote:
>>
>>> On Mar 3, 2008, at 1:20 PM, Stephan Koops wrote:
>>>>
>>>> I think, it's good, to use getOutputStream(Result), because this
>>>> make
>>>> it clearer, what is meant with the method. It could throw an
>>>> IllegalArgumentException, if an entity is set.
>>>> When using read only interfaces, very often we accpet a
>>>> UnsupportedOperationException, why no here an
>>>> IllegalArgumentException?
>>>>
>>> I guess we could do that but it might be a bit counter-intuitive for
>>> users. The alternative would be to write any entity and then return
>>> the output stream. The suggested method signature was intended to
>>> avoid this issue but I agree that:
>>>
>>> Response r = Response.created("someuri").type("sometype").build();
>>> OutputStream os = so.getOutputStream(r);
>>>
>>> is neater than:
>>>
>>> Response r = Response.created("someuri").type("sometype").build();
>>> OutputStream os = so.getOutputStream(r.getStatus(),
>>> r.getMetadata());
>>>
>>> What do others think, do you prefer getOutputStream(Response) or
>>> getOutputStream(int, MultivaluedMap<String, Object>).
>>
>> The following should have read: if you prefer the former, do you
>> prefer
>> throwing an IllegalArgumentException if Response has an entity or
>> should
>> the method write the entity and return a stream positioned at the
>> end of
>> it.
>>
>
> IMO, i'd prefer response.getOutputStream() and ditch
> StreamedOutput. It
> would be even simpler.
>
>
> But I vote for so.getOutputStream(response) if those are the only 2
> choices. Don't care on the exception.
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com <http://bill.burkecentral.com/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>
>
>
>
> Notice: This email message, together with any attachments, may
> contain information of BEA Systems, Inc., its subsidiaries and
> affiliated entities, that may be confidential, proprietary,
> copyrighted and/or legally privileged, and is intended solely for
> the use of the individual or entity named in this message. If you
> are not the intended recipient, and have received this message in
> error, please immediately return this by email and then delete it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>
---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.