users@jersey.java.net

[Jersey] How to reuse the default (JSON)JAXBContext?

From: wierob <wierob83_at_googlemail.com>
Date: Sun, 19 Dec 2010 13:29:10 -0800 (PST)

Hi,

how can I access the JSONJAXBContext used by Jersey in my Resource class?

I'm using JAXB for XML/JSON <-> annotated POJO conversion and want to reuse
the JAXBContext to convert the POJO to JSON *within* a resource method.

I tried to access the registered providers via Application.getSingeltons()
but couldn't find any providers. Injecting javax.ws.rs.ext.Providers (using
Guice) throws an NoSuchMethodException for
com.sun.jersey.spi.container.WebApplication.getProviders().

If I need to register my own JAXBContext with a ContextResolver, is it
possible to reuse Jersey's classpath scanning capabilities to find the
classes with JAXB-Annotations?

thank in advance
-- 
View this message in context: http://jersey.576304.n2.nabble.com/How-to-reuse-the-default-JSON-JAXBContext-tp5850212p5850212.html
Sent from the Jersey mailing list archive at Nabble.com.