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.servlet;
018
019import org.apache.juneau.marshall.html.*;
020import org.apache.juneau.marshall.jsonschema.*;
021import org.apache.juneau.rest.server.*;
022import org.apache.juneau.rest.server.config.*;
023import org.apache.juneau.rest.server.convention.*;
024import org.apache.juneau.rest.server.docs.*;
025import org.apache.juneau.rest.server.ops.*;
026
027/**
028 * Subclass of {@link RestServlet} with default settings and standard endpoints defined.
029 *
030 * <p>
031 * Meant as a base class for top-level REST resources in servlet containers.
032 *
033 * <p>
034 * Provides support for JSON, XML, HTML, URL-Encoding, UON, XML, OpenAPI, and MessagePack.  See {@link BasicUniversalConfig}
035 * for details.
036 *
037 * <p>
038 * The residual cross-cutting endpoints are supplied by single-responsibility op-mixins ({@link ErrorMixin},
039 * {@link HtdocMixin}, and {@link FaviconMixin}), and the api-docs surface by the
040 * api-docs mixin pack ({@link SwaggerUiMixin} and {@link RedocMixin}, which transitively pull in
041 * {@link SwaggerMixin} and {@link OpenApiMixin}). Resulting endpoints:
042 * {@code /api}, {@code /swagger}, {@code /openapi}, {@code /openapi.json}, {@code /openapi.yaml},
043 * {@code /redoc}, {@code /htdocs/*}, {@code /favicon.ico}, {@code /error}.
044 *
045 * <h2 class='section'>See Also:</h2><ul>
046 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/RestAnnotatedClasses">@Rest-Annotated Class</a>
047 * </ul>
048 *
049 * @serial exclude
050 */
051// @formatter:off
052@Rest(mixins={SwaggerUiMixin.class, RedocMixin.class, ErrorMixin.class, HtdocMixin.class, FaviconMixin.class})
053@HtmlDocConfig(
054   // Basic page navigation links.
055   navlinks={
056      "up: request:/..",
057      "api: servlet:/api"
058   }
059)
060@JsonSchemaConfig(
061   // Add descriptions to the following types when not specified:
062   addDescriptionsTo="bean,collection,array,map,enum",
063   // Add example to the following types:
064   addExamplesTo="bean,collection,array,map",
065   // Don't generate schema information on the Swagger / OpenApi beans themselves or HTML beans.
066   ignoreTypes="Swagger,OpenApi,org.apache.juneau.bean.html5.*",
067   // Use $ref references for bean definitions to reduce duplication in generated specs.
068   useBeanDefs="true"
069)
070// @formatter:on
071public abstract class BasicRestServlet extends RestServlet implements BasicUniversalConfig {
072   private static final long serialVersionUID = 1L;
073}