Re: JSR311: Response isn't adequate

From: Bill Burke <>
Date: Mon, 10 Mar 2008 10:11:10 -0400

Marc Hadley wrote:
> On Mar 7, 2008, at 3:51 PM, Bill Burke wrote:
>> 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.
> I think the combination of Response and ResponseBuilder already fulfill
> the role of representation.

public Representation get()

     Connection conn = ...;
     Blob blob = rs.getBlob(...);

     return new Representation() {
        public write(OutputStream stream) {
            // stream the output


Instead of requiring the awkward creation and registration of
MessageBodyWriters, you allow the component to return a Representation
object, which is really a MessageBodyWriter-like object instantiated by
the resource.

Restlet works this way. And so does Apache HttpClient (except in the
opposite direction). I know Ryan's initial RESTEasy project had this
idea as well.


Bill Burke
JBoss, a division of Red Hat