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