001/* 002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Nicolas Chapurlat <nchapurlat@nuxeo.com> 018 */ 019 020package org.nuxeo.ecm.webengine.jaxrs.coreiodelegate; 021 022import static javax.ws.rs.core.MediaType.APPLICATION_JSON; 023 024import java.lang.annotation.Annotation; 025import java.lang.reflect.Type; 026 027import javax.ws.rs.Produces; 028import javax.ws.rs.core.MediaType; 029import javax.ws.rs.ext.MessageBodyWriter; 030import javax.ws.rs.ext.Provider; 031 032import org.nuxeo.ecm.core.io.registry.Reader; 033import org.nuxeo.ecm.core.io.registry.Writer; 034 035/** 036 * A JAX-RS {@link MessageBodyWriter} that try to delegate marshalling to all nuxeo-core-io {@link Writer} and 037 * {@link Reader}. 038 * 039 * @since 7.2 040 */ 041@Provider 042@Produces(APPLICATION_JSON) 043public final class JsonCoreIODelegate extends PartialCoreIODelegate { 044 045 @Override 046 protected boolean accept(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { 047 return true; 048 } 049 050}