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.examples.rest; 014 015import org.apache.juneau.examples.rest.dto.*; 016import org.apache.juneau.html.annotation.*; 017import org.apache.juneau.microservice.resources.*; 018import org.apache.juneau.rest.annotation.*; 019import org.apache.juneau.rest.servlet.*; 020import org.apache.juneau.rest.widget.*; 021import org.apache.juneau.serializer.annotation.*; 022 023/** 024 * Sample REST resource showing how to implement a "router" resource page. 025 * 026 * <h5 class='section'>See Also:</h5><ul> 027 028 * </ul> 029 * 030 * @serial exclude 031 */ 032@Rest( 033 title="Root resources", 034 description="Example of a router resource page.", 035 children={ 036 HelloWorldResource.class, 037 DtoExamples.class, 038 UtilityBeansResource.class, 039 HtmlBeansResource.class, 040 ConfigResource.class, 041 LogsResource.class, 042 ShutdownResource.class 043 } 044) 045@HtmlDocConfig( 046 widgets={ 047 ContentTypeMenuItem.class 048 }, 049 navlinks={ 050 "api: servlet:/api", 051 "stats: servlet:/stats", 052 "$W{ContentTypeMenuItem}", 053 "source: $C{Source/gitHub}/org/apache/juneau/examples/rest/RootResources.java" 054 }, 055 aside={ 056 "<div class='text'>", 057 " <p>This is an example of a 'router' page that serves as a jumping-off point to child resources.</p>", 058 " <p>Resources can be nested arbitrarily deep through router pages.</p>", 059 " <p>Note the <span class='link'>API</span> link provided that lets you see the generated swagger doc for this page.</p>", 060 " <p>Also note the <span class='link'>STATS</span> link to view runtime statistics on this page.</p>", 061 " <p>Also note the <span class='link'>SOURCE</span> link to view the source code for the page.</p>", 062 " <p>All content on pages in the UI are serialized POJOs. In this case, it's a serialized array of beans with 2 properties, 'name' and 'description'.</p>", 063 " <p>Other features (such as this aside) are added through annotations.</p>", 064 "</div>" 065 }, 066 asideFloat="RIGHT" 067) 068@SerializerConfig( 069 // For testing purposes, we want to use single quotes in all the serializers so it's easier to do simple 070 // String comparisons. 071 // You can apply any of the Serializer/Parser/BeanContext settings this way. 072 quoteChar="'" 073) 074public class RootResources extends BasicRestServletGroup { 075 // IMPORTANT! If you don't need RDF support, change the parent interface to BasicUniversalConfig. 076 // It allows you to remove the Jena prerequisite. 077 078 private static final long serialVersionUID = 1L; 079}