All:

I work with Ben, and our project is written in Groovy. So far using
Restlet in Groovy is going pretty well. When we have some time we'll
post something about what we've learned.

In the meantime, to address this specific need: Groovy doesn't support
anonymous classes. So we can't use the exact code that Michael
helpfully posted:

On Tue, Mar 18, 2008 at 7:29 PM, Michael Terrington
<[EMAIL PROTECTED]> wrote:
>  And in the represent() method return a representation with the PDF
>  content.  An easy way to do that would be to override
>  OutputRepresentation like so:
>
>  Representation response =
>    new OutputRepresentation(MediaType.APPLICATION_PDF) {
>      @Override
>      public void write(OutputStream outputStream) {
>        // write your pdf data to the outputStream
>      }
>    };
>

Instead, we've had to write a ByteArrayOutputRepresentation class,
whose constructors accept either a ByteArray or an InputStream, whose
contents is then written to the OutputStream in write().

For future users of Restlet on Groovy, I'd like to suggest that this
class (or a similar one) be added to the Restlet API. I'd like some
feedback on this idea; unless I hear otherwise I'll create a RFE and
submit a patch for it.

Thanks,
Avi

-- 
Avi Flax » Partner » Compulsive Technologist » Arc90 » http://arc90.com

Reply via email to