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