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.html.*; 021import org.apache.juneau.html.annotation.*; 022import org.apache.juneau.json.*; 023import org.apache.juneau.rest.annotation.*; 024import org.apache.juneau.serializer.annotation.*; 025 026/** 027 * Basic configuration for a REST resource that supports JSON and HTML 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 * <li class='jc'>{@link HtmlDocSerializer} 040 * </ul> 041 * </li> 042 * <li class='jma'>{@link Rest#parsers() parsers}: 043 * <ul class='javatree'> 044 * <li class='jc'>{@link JsonParser} 045 * <li class='jc'>{@link Json5Parser} 046 * <li class='jc'>{@link HtmlParser} 047 * </ul> 048 * </li> 049 * <li class='jma'>{@link Rest#defaultAccept() defaultAccept}: <js>"text/json"</js> 050 * <li class='jma'>{@link Rest#config() config}: <js>"$S{juneau.configFile,SYSTEM_DEFAULT}"</js> 051 * </ul> 052 * </li> 053 * <li class='ja'>{@link BeanConfig}: 054 * <ul> 055 * <li class='jma'>{@link BeanConfig#ignoreUnknownBeanProperties() ignoreUnknownBeanProperties}: <js>"true"</js> 056 * </ul> 057 * </li> 058 * <li class='ja'>{@link SerializerConfig}: 059 * <ul> 060 * <li class='jma'>{@link SerializerConfig#uriResolution() uriResolution}: <js>"ROOT_RELATIVE"</js> 061 * </ul> 062 * </li> 063 * <li class='ja'>{@link HtmlDocConfig}: 064 * <ul> 065 * <li class='jma'>{@link HtmlDocConfig#header() header}: <js>"<h1>$RS{title}</h><h2>$RS{operationSummary,description}</h2>$C{REST/header}"</js> 066 * <li class='jma'>{@link HtmlDocConfig#navlinks() navlinks}: <js>"up: request:/.."</js> 067 * <li class='jma'>{@link HtmlDocConfig#stylesheet() stylesheet}: <js>"$C{REST/theme,servlet:/htdocs/themes/devops.css}"</js> 068 * <li class='jma'>{@link HtmlDocConfig#head() head}: <js>"$C{REST/head}"</js> 069 * <li class='jma'>{@link HtmlDocConfig#footer() footer}: <js>"$C{REST/footer}"</js> 070 * <li class='jma'>{@link HtmlDocConfig#nowrap() nowrap}: <js>"true"</js> 071 * </ul> 072 * </li> 073 * </ul> 074 * 075 * <p> 076 * This annotation can be applied to REST resource classes to define common JSON default configurations: 077 * </p> 078 * <p class='bjava'> 079 * <jc>// Used on a top-level resource.</jc> 080 * <ja>@Rest</ja> 081 * <jk>public class</jk> MyResource <jk>extends</jk> RestServlet <jk>implements</jk> BasicJsonHtmlConfig { ... } 082 * </p> 083 * <p class='bjava'> 084 * <jc>// Used on a child resource.</jc> 085 * <ja>@Rest</ja> 086 * <jk>public class</jk> MyResource <jk>extends</jk> RestObject <jk>implements</jk> BasicJsonHtmlConfig { ... } 087 * </p> 088 * 089 * <p> 090 * Note that the framework will aggregate annotations defined on all classes in the class hierarchy with 091 * values defined on child classes overriding values defined on parent classes. That allows any values defined 092 * on this interface to be overridden by annotations defined on the implemented class. 093 * </p> 094 * 095 * <h5 class='section'>See Also:</h5><ul> 096 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/RestAnnotatedClassBasics">@Rest-Annotated Class Basics</a> 097 * </ul> 098 */ 099@Rest( 100 101 // Default serializers for all Java methods in the class. 102 serializers={ 103 HtmlDocSerializer.class, 104 JsonSerializer.class, 105 Json5Serializer.class 106 }, 107 108 // Default parsers for all Java methods in the class. 109 parsers={ 110 HtmlParser.class, 111 JsonParser.class, 112 Json5Parser.class 113 }, 114 115 defaultAccept="text/json" 116) 117public interface BasicJsonHtmlConfig extends DefaultConfig, DefaultHtmlConfig {}