Hmm, am I missing something - what then is the use of "Entity Providers"?
On Sun, Jun 15, 2008 at 10:02 AM, Mark Volkmann <mark_at_ociweb.com> wrote:
> On Jun 15, 2008, at 1:04 AM, Victor Grazi wrote:
>
> Using the JAX-RS API, I am assuming there is a way to automatically
>> transform custom objects to any of a number of supported output formats.
>> But it is not clear to me how it is done or what the life cycle would be.
>>
>> For example, I would like to be able to create a method that returns a
>> Java object (of a specified type @GET public MyClass someGetMethod() - no
>> @ProduceMime specified), and depending on the Content-Type in the HTTP
>> request, have a custom converter automatically invoked that would serialize
>> that Java object to any of the Content-Types supported by my application
>> (xml, plain text, etc), and automatically return the converted result in the
>> response.
>>
>> This would allow me to create a single method that returns a Java type,
>> and have that type automatically converted to the output format specified by
>> the client, without having to create a method implementation for each
>> Content-Type in the request.
>>
>> Of course I would expect the developer to create the transformation code
>> for each return type and output format, I am just not clear on what the
>> interfaces are, how to hook it in, and in general how (or if) it works.
>>
>> If this is possible, can anyone please point me to some code samples
>> and/or explanation?
>>
>
>
> It is my understanding the JAX-RS doesn't address this. I'm convinced that
> the best way to do this for XML is to use XStream. You can find a quick
> tutorial I put together on XStream at
> http://www.ociweb.com/mark/programming/XStream.html.
>
> ---
> Mark Volkmann
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>