Hello,
we want to deploy a JAX-RS rest service on Wildfly 11. To turn on schema validation, we use a ContextResolver to deliver a custom JAX-B Context object. We figured out, that the provider is only called in case of marshalling, but nof of unmarshalling. Is this a Bug or have a usage error?
Here the custom provider
@Provider
@Produces({MediaType.APPLICATION_XML, MediaType.TEXT_XML})
@Consumes({MediaType.APPLICATION_XML, MediaType.TEXT_XML})
public class JaxbProvider implements ContextResolver<JAXBContext> {
@Override
public JAXBContext getContext(Class<?> type) {
// this method is only called in marshalling case, not for incoming requests!
JAXBContext ctx = // ... create context with schema validation enabled
return ctx;
}
}
In our Application class, the Provider is added as singleton:
@ApplicationPath("/")
public class RestApplication extends Application {
@Override
public Set<Object> getSingletons() {
Set<Object> singletons = new HashSet<>();
singletons.add(new JaxbProvider());
return singletons;
}
}
Thanks for the help
Regards