All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gwizard.jersey.ObjectMapperContextResolver Maven / Gradle / Ivy

There is a newer version: 0.10
Show newest version
package org.gwizard.jersey;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.inject.Inject;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;

/**
 * A little wiring that lets us give the guice ObjectMapper to JAXRS frameworks.
 */
@Provider   // Not the guice provider annotation...
public class ObjectMapperContextResolver implements ContextResolver {
    private final ObjectMapper objectMapper;

    @Inject
    public ObjectMapperContextResolver(ObjectMapper objectMapper) {
        this.objectMapper = objectMapper;
    }

    @Override
    public ObjectMapper getContext(Class type) {
        return objectMapper;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy