users@jersey.java.net

Re: [Jersey] Modifying JAXB Behavior for Returned Objects

From: Tim McNerney <java_at_oneofus.org>
Date: Tue, 20 Oct 2009 06:28:14 -0700

Thanks for the info. I'm hoping not to write my own marshaling code (cause
it is so nice and clean to use that feature provided by default). I'll
probably work through without the ability to control the level of detail
returned until such time as it becomes a bottleneck and then consider
something more extreme.
--Tim

On Tue, Oct 20, 2009 at 1:23 AM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:

>
> On Oct 19, 2009, at 8:03 PM, Tatu Saloranta wrote:
>
> On Fri, Oct 16, 2009 at 3:27 PM, Tim McNerney <java_at_oneofus.org> wrote:
>>
>>> I'm using JAXB notation on a simple bean as a return value for some @GET
>>> methods, converted to either JSON or XML. In one case, I am return a
>>> single
>>> instance, but in another, I return a list of items. For the single
>>> object,
>>> I'd like to convert to the complete value, but when returning a list, I'd
>>> like an abbreviated representation. Is there any declarative way to do
>>> this?
>>>
>>
>> You could use different objects for separate cases; with a common
>> abstract base class?
>>
>
> Yes, such support is not possible with JAXB unless you do the above or
> develop some form of customer marshaling i.e. this is something that could
> potentially be developed and supported by a JAXB-style extension supplied by
> Jersey but it is not something we have right now.
>
> Paul.
>
>
>
> I don't know if it's otherwise cleanly possible -- sounds like you are
>> trying to create a union type of sorts, which is not something you
>> typically do in Java.
>>
>>
> -+ Tatu +-
>>
>> ---------------------------------------------------------------------
>> 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
>
>