users@jersey.java.net

[Jersey] How to move namespace declarations up to the root element?

From: Markus Karg <karg_at_quipsy.de>
Date: Thu, 12 May 2011 12:39:13 +0200

I'm not a JAXB guru so I need to ask silly questions like the
following...:

 

JAX-RS is marshalling the resulting entity for a request internally,
what is a great feature. In my case, the XML output contains lots of
namespaces, and most of them repeat again and again. So I'd like to
"pull up" the prefix declarations to the root node.

 

Does anybody know how to solve that from within a JAX-RS resource? As I
am using a custom ContextResolver anyways I could tweak the JAXBContext
if that is need.

 

Thanks!

Markus