dev@jsr311.java.net

Re: JSR311: Response isn't adequate

From: Bill Burke <bburke_at_redhat.com>
Date: Mon, 10 Mar 2008 15:10:18 -0400

Marc Hadley wrote:
> On Mar 10, 2008, at 2:22 PM, Jerome Louvel wrote:
>> Marc and Stephan proposed balanced
>> solutions that seem reasonable to me, even if they add a little more
>> complexity from your point of view.
>>
> Bill also suggested:
>
>> @GET
>> public Representation get()
>> {
>>
>> Connection conn = ...;
>> Blob blob = rs.getBlob(...);
>>
>> return new Representation() {
>> public write(OutputStream stream) {
>> // stream the output
>> blob.close();
>> rs.close();
>> conn.close();
>> }
>> };
>>
>> }
>
> Which is actually pretty similar to Stephan's:
>

I want the Representation thing *and* the ability to use an
OutputStream. Let me summarize:

* MessageBodyReader/Writer is nice because it allows the spec and vendor
implementations to prepackage handling of certain Java and mime types.

* OutputSTream is nice because its a model programmers are used to and
provides a very simple way of streaming dynamic data. It also helps in
tangent use cases like the transactional BLOB one I gave before.

* Representation is nice because it gives the application developer the
ability to define entity processing dynamically on its own.

Bill

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