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; 014 015import org.apache.juneau.annotation.*; 016import org.apache.juneau.html.*; 017import org.apache.juneau.html.annotation.*; 018import org.apache.juneau.json.*; 019import org.apache.juneau.msgpack.*; 020import org.apache.juneau.oapi.*; 021import org.apache.juneau.plaintext.*; 022import org.apache.juneau.rest.annotation.*; 023import org.apache.juneau.rest.config.*; 024import org.apache.juneau.serializer.annotation.*; 025import org.apache.juneau.soap.*; 026import org.apache.juneau.uon.*; 027import org.apache.juneau.urlencoding.*; 028import org.apache.juneau.xml.*; 029import org.apache.juneau.xmlschema.XmlSchemaDocSerializer; 030 031/** 032 * Basic configuration for a REST resource that supports all languages. 033 * 034 * <p> 035 * Classes that don't extend from {@link BasicRestServlet} can implement this interface to 036 * be configured with the same serializers/parsers/etc... as {@link BasicRestServlet}. 037 * 038 * @deprecated Use {@link BasicUniversalRest}. 039 */ 040@Rest( 041 042 // Default serializers for all Java methods in the class. 043 serializers={ 044 HtmlDocSerializer.class, // HTML must be listed first because Internet Explore does not include text/html in their Accept header. 045 HtmlStrippedDocSerializer.class, 046 HtmlSchemaDocSerializer.class, 047 JsonSerializer.class, 048 SimpleJsonSerializer.class, 049 JsonSchemaSerializer.class, 050 XmlDocSerializer.class, 051 XmlSchemaDocSerializer.class, 052 UonSerializer.class, 053 UrlEncodingSerializer.class, 054 OpenApiSerializer.class, 055 MsgPackSerializer.class, 056 SoapXmlSerializer.class, 057 PlainTextSerializer.class 058 }, 059 060 // Default parsers for all Java methods in the class. 061 parsers={ 062 JsonParser.class, 063 SimpleJsonParser.class, 064 XmlParser.class, 065 HtmlParser.class, 066 UonParser.class, 067 UrlEncodingParser.class, 068 OpenApiParser.class, 069 MsgPackParser.class, 070 PlainTextParser.class 071 }, 072 073 // Optional external configuration file. 074 config="$S{juneau.configFile,SYSTEM_DEFAULT}", 075 076 // These are static files that are served up by the servlet under the specified sub-paths. 077 // For example, "/servletPath/htdocs/javadoc.css" resolves to the file "[servlet-package]/htdocs/javadoc.css" 078 // By default, we define static files through the external configuration file. 079 staticFiles="$C{REST/staticFiles,htdocs:/htdocs,htdocs:htdocs}", 080 081 logging=@Logging( 082 level="INFO", 083 useStackTraceHashing="true", 084 rules={ 085 @LoggingRule(codes="500-", level="WARNING") 086 } 087 ) 088) 089@SerializerConfig( 090 // Enable automatic resolution of URI objects to root-relative values. 091 uriResolution="ROOT_RELATIVE" 092) 093@HtmlDocConfig( 094 095 // Default page header contents. 096 header={ 097 "<h1>$R{resourceTitle}</h1>", // Use @Rest(title) 098 "<h2>$R{methodSummary,resourceDescription}</h2>", // Use either @RestMethod(summary) or @Rest(description) 099 "$C{REST/header}" // Extra header HTML defined in external config file. 100 }, 101 102 // Basic page navigation links. 103 navlinks={ 104 "up: request:/.." 105 }, 106 107 // Default stylesheet to use for the page. 108 // Can be overridden from external config file. 109 // Default is DevOps look-and-feel (aka Depression look-and-feel). 110 stylesheet="$C{REST/theme,servlet:/htdocs/themes/devops.css}", 111 112 // Default contents to add to the <head> section of the HTML page. 113 // Use it to add a favicon link to the page. 114 head="$C{REST/head}", 115 116 // No default page footer contents. 117 // Can be overridden from external config file. 118 footer="$C{REST/footer}", 119 120 // By default, table cell contents should not wrap. 121 nowrap="true" 122) 123@BeanConfig( 124 // When parsing generated beans, ignore unknown properties that may only exist as getters and not setters. 125 ignoreUnknownBeanProperties="true" 126) 127@Deprecated 128public interface BasicRestConfig {}