/** * ============================================================================= * * ORCID (R) Open Source * http://orcid.org * * Copyright (c) 2012-2014 ORCID, Inc. * Licensed under an MIT-Style License (MIT) * http://orcid.org/open-source-license * * This copyright and license information (including a link to the full license) * shall be included in its entirety in all copies or substantial portion of * the software. * * ============================================================================= */ package org.orcid.api.common.jaxb; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.ext.Provider; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.jaxrs.cfg.Annotations; import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; /** * @author Will Simpson */ @Provider @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public class OrcidJacksonJaxbJsonProvider extends JacksonJaxbJsonProvider { public OrcidJacksonJaxbJsonProvider() { super(); configureAll(); } public OrcidJacksonJaxbJsonProvider(Annotations... annotationsToUse) { super(annotationsToUse); configureAll(); } public OrcidJacksonJaxbJsonProvider(ObjectMapper mapper, Annotations[] annotationsToUse) { super(mapper, annotationsToUse); configureAll(); } private void configureAll() { configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); configure(SerializationFeature.INDENT_OUTPUT, false); } }