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 static org.apache.juneau.serializer.Serializer.*; 016 017import org.apache.juneau.html.*; 018import org.apache.juneau.json.*; 019import org.apache.juneau.msgpack.*; 020import org.apache.juneau.plaintext.*; 021import org.apache.juneau.rest.annotation.*; 022import org.apache.juneau.soap.*; 023import org.apache.juneau.uon.*; 024import org.apache.juneau.urlencoding.*; 025import org.apache.juneau.xml.*; 026 027/** 028 * Basic configuration for a REST resource. 029 * 030 * <p> 031 * Classes that don't extend from {@link BasicRestServlet} can implement this interface to 032 * be configured with the same serializers/parsers/etc... as {@link BasicRestServlet}. 033 */ 034@RestResource( 035 serializers={ 036 HtmlDocSerializer.class, // HTML must be listed first because Internet Explore does not include text/html in their Accept header. 037 HtmlStrippedDocSerializer.class, 038 HtmlSchemaDocSerializer.class, 039 JsonSerializer.class, 040 JsonSerializer.Simple.class, 041 JsonSchemaSerializer.class, 042 XmlDocSerializer.class, 043 XmlSchemaDocSerializer.class, 044 UonSerializer.class, 045 UrlEncodingSerializer.class, 046 MsgPackSerializer.class, 047 SoapXmlSerializer.class, 048 PlainTextSerializer.class 049 }, 050 parsers={ 051 JsonParser.class, 052 XmlParser.class, 053 HtmlParser.class, 054 UonParser.class, 055 UrlEncodingParser.class, 056 MsgPackParser.class, 057 PlainTextParser.class 058 }, 059 properties={ 060 // URI-resolution is disabled by default. Need to enable it. 061 @Property(name=SERIALIZER_uriResolution, value="ROOT_RELATIVE") 062 }, 063 htmldoc=@HtmlDoc( 064 header={ 065 "<h1>$R{resourceTitle}</h1>", 066 "<h2>$R{methodSummary,resourceDescription}</h2>", 067 "<a href='http://juneau.apache.org'><img src='$U{servlet:/htdocs/juneau.png}' style='position:absolute;top:5;right:5;background-color:transparent;height:30px'/></a>" 068 }, 069 navlinks={ 070 "up: request:/.." 071 }, 072 stylesheet="$C{REST/stylesheet,servlet:/styles/devops.css}", 073 head={ 074 "<link rel='icon' href='$U{servlet:/htdocs/juneau.png}'/>" 075 } 076 ), 077 078 // Optional external configuration file. 079 config="$S{juneau.configFile}", 080 081 // These are static files that are served up by the servlet under the specified sub-paths. 082 // For example, "/servletPath/htdocs/javadoc.css" resolves to the file "[servlet-package]/htdocs/javadoc.css" 083 staticFiles={"htdocs:htdocs","styles:styles"} 084) 085public interface BasicRestConfig {}