users@jersey.java.net

[Jersey] Using Jackson for data binding with annotations

From: <jdreux_at_justlexit.com>
Date: Mon, 14 May 2012 18:54:39 +0000 (GMT)

I am using Jersey over Tomcat on a project currently in production. I
have been setting up my mapper as follows:

public abstract class AbstractBusinessServices extends Application
implements ContextResolver<JAXBContext>{

...

public AbstractBusinessServices() {
                try {
                        this.types = this.getWebserviceModelClasses();
                        this.context = new
JSONJAXBContext(JSONConfiguration.natural().build(), types);
...

}

This has been working fine, but now we are hitting problem with JSON
format that seem to be due to limitations of the JAXB parser. I want to
use pure Jackson for marshalling and unmarshalling, and everywhere I
look I see that I need to use this:


<init-param>
               
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
                <param-value>true</param-value>
        </init-param>

However I am using annotations everywhere, and I don't have a web.xml.
What can I do to get this working with annotations?

Thanks,

Julien