Resteasy has jackson support.

Additionally, you're gonna have to write and register a ContextResolver 
for Jackson's ObjectMapper:

@Provider
public class MyObjectMapper implements ContextResolver<ObjectMapper>
{
     public ObjectMapper getContext(Class<?> type)
     {
         if (!enabledFor(type)) return null;

         ObjectMapper mapper = new ObjectMapper();
         JaxbAnnotationIntrospector intr = new JaxbAnnotationIntrospector();
         mapper.getDeserializationConfig().setAnnotationIntrospector(intr);
         mapper.getSerializationConfig().setAnnotationIntrospector(intr);

         return mapper;

     }

}

That's the base of it, you'll have to fidlle with mapper configuration 
to get the desired json output you want.

IMO, you should ditch the idea of using JAXB and just use Jackson's 
annotations.

On 11/20/2012 10:08 AM, Henrik Brautaset Aronsen wrote:
> HI.
>
> I've got a a method that returns a List<String>, which works fine as
> long as there are > 1 objects in the list.  If the list only has a
> single object, however, it just returns that single object without the
> wrapping list.
>
> I see that I can solve this in Jersey with some configuration [1] in
> web.xml:
>
> <init-param>
> <param-name>com.sun.jersey.config.property.packages</param-name>
> <param-value>your.project.packages;org.codehaus.jackson.jaxrs</param-value>
> </init-param>
>
> How is this solved in RESTEasy?
>
> Cheers,
>
> Henrik
>
> [1] 
> http://stackoverflow.com/questions/2199453/how-can-i-customize-serialization-of-a-list-of-jaxb-objects-to-json/3143214#3143214
>
>
>
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from $795 for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
>
>
>
> _______________________________________________
> Resteasy-users mailing list
> Resteasy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to