001/*
002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl-2.1.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Nicolas Chapurlat <nchapurlat@nuxeo.com>
016 */
017
018package org.nuxeo.ecm.webengine.jaxrs.coreiodelegate;
019
020import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
021
022import java.lang.annotation.Annotation;
023import java.lang.reflect.Type;
024
025import javax.ws.rs.Produces;
026import javax.ws.rs.core.MediaType;
027import javax.ws.rs.ext.MessageBodyWriter;
028import javax.ws.rs.ext.Provider;
029
030import org.nuxeo.ecm.core.io.registry.Reader;
031import org.nuxeo.ecm.core.io.registry.Writer;
032
033/**
034 * A JAX-RS {@link MessageBodyWriter} that try to delegate marshalling to all nuxeo-core-io {@link Writer} and
035 * {@link Reader}.
036 *
037 * @since 7.2
038 */
039@Provider
040@Produces({ APPLICATION_JSON, APPLICATION_JSON + "+nxrequest", APPLICATION_JSON + "+nxentity" })
041public final class JsonCoreIODelegate extends PartialCoreIODelegate {
042
043    @Override
044    protected boolean accept(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
045        return true;
046    }
047
048}