001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.rest.server.config; 018 019import org.apache.juneau.commons.bean.*; 020import org.apache.juneau.marshall.*; 021import org.apache.juneau.marshall.json.*; 022import org.apache.juneau.marshall.json5.*; 023import org.apache.juneau.marshall.serializer.*; 024import org.apache.juneau.rest.server.*; 025 026/** 027 * Basic configuration for a REST resource that supports JSON transport. 028 * 029 * <p> 030 * Default settings defined: 031 * </p> 032 * <ul class='spaced-list'> 033 * <li class='ja'>{@link Rest}: 034 * <ul> 035 * <li class='jma'>{@link Rest#serializers() serializers}: 036 * <ul class='javatree'> 037 * <li class='jc'>{@link JsonSerializer} 038 * <li class='jc'>{@link Json5Serializer} 039 * </ul> 040 * </li> 041 * <li class='jma'>{@link Rest#parsers() parsers}: 042 * <ul class='javatree'> 043 * <li class='jc'>{@link JsonParser} 044 * <li class='jc'>{@link Json5Parser} 045 * </ul> 046 * </li> 047 * <li class='jma'>{@link Rest#defaultAccept() defaultAccept}: <js>"text/json"</js> 048 * <li class='jma'>{@link Rest#config() config}: <js>"$S{juneau.configFile,SYSTEM_DEFAULT}"</js> 049 * </ul> 050 * </li> 051 * <li class='ja'>{@link MarshalledConfig}: 052 * <ul> 053 * <li class='jma'>{@link BeanConfig#ignoreUnknownBeanProperties() ignoreUnknownBeanProperties}: <js>"true"</js> 054 * </ul> 055 * </li> 056 * <li class='ja'>{@link SerializerConfig}: 057 * <ul> 058 * <li class='jma'>{@link SerializerConfig#uriResolution() uriResolution}: <js>"ROOT_RELATIVE"</js> 059 * </ul> 060 * </li> 061 * </ul> 062 * 063 * <p> 064 * This annotation can be applied to REST resource classes to define common JSON default configurations: 065 * </p> 066 * <p class='bjava'> 067 * <jc>// Used on a top-level resource.</jc> 068 * <ja>@Rest</ja> 069 * <jk>public class</jk> MyResource <jk>extends</jk> RestServlet <jk>implements</jk> BasicJsonConfig { ... } 070 * </p> 071 * <p class='bjava'> 072 * <jc>// Used on a child resource.</jc> 073 * <ja>@Rest</ja> 074 * <jk>public class</jk> MyResource <jk>extends</jk> RestResource <jk>implements</jk> BasicJsonConfig { ... } 075 * </p> 076 * 077 * <p> 078 * Note that the framework will aggregate annotations defined on all classes in the class hierarchy with 079 * values defined on child classes overriding values defined on parent classes. That allows any values defined 080 * on this interface to be overridden by annotations defined on the implemented class. 081 * </p> 082 * 083 * <h5 class='section'>See Also:</h5><ul> 084 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/RestAnnotatedClasses">@Rest-Annotated Class</a> 085 * </ul> 086 */ 087// @formatter:off 088@Rest( 089 090 // Default serializers for all Java methods in the class. 091 serializers={ 092 JsonSerializer.class, 093 Json5Serializer.class 094 }, 095 096 // Default parsers for all Java methods in the class. 097 parsers={ 098 JsonParser.class, 099 Json5Parser.class 100 }, 101 102 defaultAccept="text/json" 103) 104public interface BasicJsonConfig extends DefaultConfig {}