Example usage for com.fasterxml.jackson.jaxrs.cfg Annotations JAXB

List of usage examples for com.fasterxml.jackson.jaxrs.cfg Annotations JAXB

Introduction

In this page you can find the example usage for com.fasterxml.jackson.jaxrs.cfg Annotations JAXB.

Prototype

Annotations JAXB

To view the source code for com.fasterxml.jackson.jaxrs.cfg Annotations JAXB.

Click Source Link

Document

Standard JAXB annotations, used in a way that approximates expected definitions (since JAXB defines XML aspects, not all features map well to JSON handling)

Usage

From source file:org.killbill.commons.skeleton.modules.JaxrsJacksonModule.java

public JaxrsJacksonModule(final ObjectMapper mapper) {
    this(mapper, Annotations.JACKSON, Annotations.JAXB);
}

From source file:org.usrz.libs.httpd.handlers.RestHandlerProvider.java

@Override
protected HttpHandler get(Injector injector, Configurations configurations) {

    /* Setup our object mapper (could be qualified with path) */
    final ObjectMapper mapper = getInstance(injector, ObjectMapper.class, path);

    final Map<Class<?>, Integer> contractPriorities = new HashMap<>();
    contractPriorities.put(MessageBodyWriter.class, Integer.MIN_VALUE);
    contractPriorities.put(MessageBodyReader.class, Integer.MIN_VALUE);
    config.register(//ww w.ja  v  a2 s.c  om
            new JacksonJsonProvider(mapper, new Annotations[] { Annotations.JACKSON, Annotations.JAXB }),
            Collections.unmodifiableMap(contractPriorities));

    /* Create a ServiceLocator parent of all locators and inject the configurations */
    final ServiceLocator locator = ServiceLocatorFactory.create(injector, path);

    /* Set up the ObjectMapper that will be used by this application */
    ServiceLocatorUtilities.addOneConstant(locator, mapper, null, ObjectMapper.class);

    /* Create a brand new Grizzly HTTP container from Jersey */
    log.debug("Jersey application at \"%s\" initializing", path.value());
    GrizzlyHttpContainer container = GrizzlyHttpContainerFactory.create(config, locator);
    log.info("Jersey application at \"%s\" initialized successfully", path.value());

    /* Create our handler and add it to our server configuration  */
    final HttpServer server = injector.getInstance(HttpServer.class);
    server.getServerConfiguration().addHttpHandler(container, path.value());
    log.info("Serving \"%s\" using Jersey application \"%s\"", path.value(), config.getApplicationName());

    /* All done! */
    return container;
}

From source file:com.dell.asm.asmcore.asmmanager.util.ProxyUtil.java

public static void initAsmDeployerProxy() {
    // asm-deployer does not require the auth headers the java services do and always uses json
    JacksonJaxbJsonProvider provider = new AsmJacksonJsonProvider();
    provider.setAnnotationsToUse(new Annotations[] { Annotations.JACKSON, Annotations.JAXB });

    asmDeployerProxy = JAXRSClientFactory.create(AsmManagerApp.asmDeployerApiUrl, IAsmDeployerService.class,
            Collections.singletonList(provider));
    WebClient.client(asmDeployerProxy).type(MediaType.APPLICATION_JSON);
    WebClient.client(asmDeployerProxy).accept(MediaType.APPLICATION_JSON);
}