Hi
On 29/05/15 11:28, Martin Nielsen wrote:
Hi!
I need to add a provider to transform some jaxb annotated classes into html.
I found this piece of documentation:
http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-Customizingmediatypesformessagebodyproviders
It says "One can easily register a provider either from Spring
configuration or programmatically:"
But i don't see the programatic example.
Can someone help me to understand how i can register a provider that can
transform a number of jaxb objects to htrml without using Spring?
I can write the MessageBodyWriter and MessageBodyReader myself, its more
the registration part that i don't understand.
One option is to do
CustomApplication application = new CustomApplication();
RuntimeDelegate delegate = RuntimeDelegate.getInstance();
JAXRSServerFactoryBean bean = delegate.createEndpoint(application,
JAXRSServerFactoryBean.class);
bean.setAddress("http://localhost:8080/services");
Server server = bean.create();
server.start();
where CustomApplication is a JAX-RS Application providing custom providers.
Alternatively create only JAXRSServerFactoryBean and set providers on it
directly using setProviders()...
HTH, Sergey