Search in sources :

Example 1 with ValidationExceptionMapper

use of org.apache.cxf.jaxrs.validation.ValidationExceptionMapper in project cxf by apache.

the class BookStoreCustomApplication method getSingletons.

@Override
public Set<Object> getSingletons() {
    Set<Object> singletons = new HashSet<>();
    singletons.add(new JacksonJsonProvider());
    singletons.add(new ValidationExceptionMapper());
    singletons.add(new JAXRSBeanValidationFeature());
    singletons.add(new LoggingFilter());
    return singletons;
}
Also used : JAXRSBeanValidationFeature(org.apache.cxf.jaxrs.validation.JAXRSBeanValidationFeature) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) LoggingFilter(org.apache.cxf.systests.cdi.base.bindings.LoggingFilter) ValidationExceptionMapper(org.apache.cxf.jaxrs.validation.ValidationExceptionMapper) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Example 2 with ValidationExceptionMapper

use of org.apache.cxf.jaxrs.validation.ValidationExceptionMapper in project tomee by apache.

the class CxfRsHttpListener method addMandatoryProviders.

private void addMandatoryProviders(final Collection<Object> instances, final ServiceConfiguration serviceConfiguration) {
    if (SystemInstance.get().getProperty("openejb.jaxrs.jsonProviders") == null) {
        if (!shouldSkipProvider(WadlDocumentMessageBodyWriter.class.getName())) {
            instances.add(new WadlDocumentMessageBodyWriter());
        }
    }
    if (!shouldSkipProvider(EJBExceptionMapper.class.getName())) {
        instances.add(new EJBExceptionMapper());
    }
    if (!shouldSkipProvider(ValidationExceptionMapper.class.getName())) {
        instances.add(new ValidationExceptionMapper());
        final String level = SystemInstance.get().getProperty("openejb.cxf.rs.bval.log.level", serviceConfiguration.getProperties().getProperty(CXF_JAXRS_PREFIX + "bval.log.level"));
        if (level != null) {
            try {
                LogUtils.getL7dLogger(ValidationExceptionMapper.class).setLevel(Level.parse(level));
            } catch (final UnsupportedOperationException uoe) {
                LOGGER.warning("Can't set level " + level + " on " + "org.apache.cxf.jaxrs.validation.ValidationExceptionMapper logger, " + "please configure it in your logging framework.");
            }
        }
    }
}
Also used : WadlDocumentMessageBodyWriter(org.apache.johnzon.jaxrs.WadlDocumentMessageBodyWriter) ValidationExceptionMapper(org.apache.cxf.jaxrs.validation.ValidationExceptionMapper)

Aggregations

ValidationExceptionMapper (org.apache.cxf.jaxrs.validation.ValidationExceptionMapper)2 JacksonJsonProvider (com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 JAXRSBeanValidationFeature (org.apache.cxf.jaxrs.validation.JAXRSBeanValidationFeature)1 LoggingFilter (org.apache.cxf.systests.cdi.base.bindings.LoggingFilter)1 WadlDocumentMessageBodyWriter (org.apache.johnzon.jaxrs.WadlDocumentMessageBodyWriter)1