Le examples that I've found parle de la définition du gestionnaire de validation sur un objet unmarshaller
. Cependant, en utilisant Jersey, MOXy/JAXB est initialisé pour moi et je ne sais pas comment accéder au unmarshaller.Comment enregistrer un ValidationEventHandler avec Moxy dans Jersey?
Actuellement, je bootstrap Jersey comme ceci, avec jersey-media-moxy
étant sur le classpath.
@ApplicationPath("rest")
public class ApplicationConfig extends ResourceConfig {
Logger logger = LoggerFactory.getLogger(ApplicationConfig.class);
public ApplicationConfig() {
// Scan classes in this package and subpackages
logger.info("Registering REST Application");
packages("rest");
register(new AbstractBinder() {
@Override
protected void configure() {
// used to automatically inject a Connection instance and close it
bindFactory(ConnectionFactory.class).to(Connection.class)
.proxy(true).proxyForSameScope(false).in(RequestScoped.class);
}
});
}
}
Avec cette approche, comment puis-je enregistrer un ValidationEventHandler
sur le unmarshaller?