users@jersey.java.net

[Jersey] Re: Using Jackson for data binding with annotations

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Mon, 14 May 2012 13:17:38 -0700

On Mon, May 14, 2012 at 12:32 PM, Julien Dreux <jdreux_at_justlexit.com> wrote:
> Here's how I am doing it. This works, I see the JSON generated, but the
> output is still in a bad format:
>

Right. It seems to me that with this:

> @Provider
>
> public abstract class AbstractBusinessServices extends Application
> implements ContextResolver<JacksonJsonProvider>,
>
> ExceptionMapper<Exception>{
>
> private JacksonJsonProvider context;
>
> private Class[] types;
>
>
> private Logger logger =
> LoggerFactory.getLogger(AbstractBusinessServices.class.getName());
>
>
> public AbstractBusinessServices() {

you should just add something like:

@Override
public Set<Object> getSingletons() {
   Set<Object> s = new HashSet<Object>();
   s.add(new JacksonJsonProvider());
   return s;
}

to add the provider, and things would work...

-+ Tatu +-