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.config; 018 019import org.apache.juneau.annotation.*; 020import org.apache.juneau.json.*; 021import org.apache.juneau.rest.annotation.*; 022import org.apache.juneau.serializer.annotation.*; 023 024/** 025 * Basic configuration for a REST resource that supports JSON transport. 026 * 027 * <p> 028 * Default settings defined: 029 * </p> 030 * <ul class='spaced-list'> 031 * <li class='ja'>{@link Rest}: 032 * <ul> 033 * <li class='jma'>{@link Rest#serializers() serializers}: 034 * <ul class='javatree'> 035 * <li class='jc'>{@link JsonSerializer} 036 * <li class='jc'>{@link Json5Serializer} 037 * </ul> 038 * </li> 039 * <li class='jma'>{@link Rest#parsers() parsers}: 040 * <ul class='javatree'> 041 * <li class='jc'>{@link JsonParser} 042 * <li class='jc'>{@link Json5Parser} 043 * </ul> 044 * </li> 045 * <li class='jma'>{@link Rest#defaultAccept() defaultAccept}: <js>"text/json"</js> 046 * <li class='jma'>{@link Rest#config() config}: <js>"$S{juneau.configFile,SYSTEM_DEFAULT}"</js> 047 * </ul> 048 * </li> 049 * <li class='ja'>{@link BeanConfig}: 050 * <ul> 051 * <li class='jma'>{@link BeanConfig#ignoreUnknownBeanProperties() ignoreUnknownBeanProperties}: <js>"true"</js> 052 * </ul> 053 * </li> 054 * <li class='ja'>{@link SerializerConfig}: 055 * <ul> 056 * <li class='jma'>{@link SerializerConfig#uriResolution() uriResolution}: <js>"ROOT_RELATIVE"</js> 057 * </ul> 058 * </li> 059 * </ul> 060 * 061 * <p> 062 * This annotation can be applied to REST resource classes to define common JSON default configurations: 063 * </p> 064 * <p class='bjava'> 065 * <jc>// Used on a top-level resource.</jc> 066 * <ja>@Rest</ja> 067 * <jk>public class</jk> MyResource <jk>extends</jk> RestServlet <jk>implements</jk> BasicJsonConfig { ... } 068 * </p> 069 * <p class='bjava'> 070 * <jc>// Used on a child resource.</jc> 071 * <ja>@Rest</ja> 072 * <jk>public class</jk> MyResource <jk>extends</jk> RestObject <jk>implements</jk> BasicJsonConfig { ... } 073 * </p> 074 * 075 * <p> 076 * Note that the framework will aggregate annotations defined on all classes in the class hierarchy with 077 * values defined on child classes overriding values defined on parent classes. That allows any values defined 078 * on this interface to be overridden by annotations defined on the implemented class. 079 * </p> 080 * 081 * <h5 class='section'>See Also:</h5><ul> 082 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/RestAnnotatedClassBasics">@Rest-Annotated Class Basics</a> 083 * </ul> 084 */ 085@Rest( 086 087 // Default serializers for all Java methods in the class. 088 serializers={ 089 JsonSerializer.class, 090 Json5Serializer.class 091 }, 092 093 // Default parsers for all Java methods in the class. 094 parsers={ 095 JsonParser.class, 096 Json5Parser.class 097 }, 098 099 defaultAccept="text/json" 100) 101public interface BasicJsonConfig extends DefaultConfig {}