users@jersey.java.net

Re: [Jersey] Supported Mime Tyes in Jersey

From: Naresh <Srinivas.Bhimisetty_at_Sun.COM>
Date: Tue, 28 Jul 2009 12:18:53 +0530

Craig McClanahan wrote:
> 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.
Oh yes!
Thanks for pointing that out, I was thinking of generating the data at
the server side using the APIs for pdf, spreadsheet, etc. If the
documents are already there on the server, then probably yes passing the
InputStream is a better option.

-Naresh
>
> 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
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>