users@jersey.java.net

Re: [Jersey] Supported Mime Tyes in Jersey

From: Craig McClanahan <Craig.McClanahan_at_Sun.COM>
Date: Mon, 27 Jul 2009 23:30:06 -0700

Naresh wrote:
> Hi Suchita,
>
> I believe you can use these mime-types in your @Produces annotation,
> but you will have to proivide the MessageBodyWriter providers for
> these mime-types.
>
That's correct, but there is one pretty easy possibility. If you have
these documents on your server already, the simplest thing to do would
be to pass an InputStream (to the content bytes) as your entity. Jersey
(and all JAX-RS implementations) already have a MessageBodyWriter that
knows how to just copy all the bytes straight through, with no
transformations.

You'll need a MessageBodyWriter if, for example, you want to convert an
XML document into a spreadsheet, or something like that.
> -Naresh
>
Craig
> Suchitha Koneru (sukoneru) wrote:
>>
>> Hello Jersey Users,
>>
>> Are the mime types(doc, xls and pdf) supported in Jersey ? Can we use
>> the following annotation for specifying these mime types
>>
>> @Produces ( {“application/pdf “ , “application/doc” , ”
>> application/xls”})
>>
>> Thank You,
>>
>> Suchitha.
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>