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 027import jakarta.servlet.http.*; 028 029/** 030 * Identical to {@link BasicRestServlet} but doesn't extend from {@link HttpServlet}. 031 * 032 * <p> 033 * Meant as a base class for child REST resources in servlet containers and Spring Boot environments. 034 * 035 * <p> 036 * Provides support for JSON, XML, HTML, URL-Encoding, UON, XML, OpenAPI, and MessagePack. See {@link BasicUniversalConfig} 037 * for details. 038 * 039 * <p> 040 * The residual cross-cutting endpoints are supplied by single-responsibility op-mixins ({@link ErrorMixin}, 041 * {@link HtdocMixin}, {@link StatsMixin}, and {@link FaviconMixin}), and the api-docs surface by the 042 * api-docs mixin pack ({@link SwaggerUiMixin} and {@link RedocMixin}, which transitively pull in 043 * {@link SwaggerMixin} and {@link OpenApiMixin}). Resulting endpoints: 044 * {@code /api}, {@code /swagger}, {@code /openapi}, {@code /openapi.json}, {@code /openapi.yaml}, 045 * {@code /redoc}, {@code /htdocs/*}, {@code /favicon.ico}, {@code /stats}, {@code /error}. 046 * 047 * <h5 class='section'>See Also:</h5><ul> 048 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/RestAnnotatedClasses">@Rest-Annotated Class</a> 049 * </ul> 050 */ 051// @formatter:off 052@Rest(mixins={SwaggerUiMixin.class, RedocMixin.class, ErrorMixin.class, HtdocMixin.class, StatsMixin.class, FaviconMixin.class}) 053@HtmlDocConfig( 054 // Basic page navigation links. 055 navlinks={ 056 "up: request:/..", 057 "api: servlet:/api", 058 "stats: servlet:/stats" 059 } 060) 061@JsonSchemaConfig( 062 // Add descriptions to the following types when not specified: 063 addDescriptionsTo="bean,collection,array,map,enum", 064 // Add example to the following types: 065 addExamplesTo="bean,collection,array,map", 066 // Don't generate schema information on the Swagger / OpenApi beans themselves or HTML beans. 067 ignoreTypes="Swagger,OpenApi,org.apache.juneau.bean.html5.*", 068 // Use $ref references for bean definitions to reduce duplication in generated specs. 069 useBeanDefs="true" 070) 071// @formatter:on 072public abstract class BasicRestResource extends RestResource implements BasicUniversalConfig {}