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.*; 019import org.apache.juneau.rest.annotation.*; 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 * <ul class='seealso'> 027 * <li class='extlink'>{@source} 028 * </ul> 029 */ 030@Rest( 031 path="/*", 032 title="Root resources", 033 description="Example of a router resource page.", 034 children={ 035 HelloWorldResource.class, 036 DtoExamples.class, 037 ConfigResource.class, 038 LogsResource.class, 039 ShutdownResource.class 040 } 041) 042@HtmlDocConfig( 043 widgets={ 044 ContentTypeMenuItem.class, 045 ThemeMenuItem.class 046 }, 047 navlinks={ 048 "options: servlet:/?method=OPTIONS", 049 "stats: servlet:/stats", 050 "$W{ContentTypeMenuItem}", 051 "$W{ThemeMenuItem}", 052 "source: $C{Source/gitHub}/org/apache/juneau/examples/rest/$R{servletClassSimple}.java" 053 }, 054 aside={ 055 "<div style='max-width:400px' class='text'>", 056 " <p>This is an example of a 'router' page that serves as a jumping-off point to child resources.</p>", 057 " <p>Resources can be nested arbitrarily deep through router pages.</p>", 058 " <p>Note the <span class='link'>options</span> link provided that lets you see the generated swagger doc for this page.</p>", 059 " <p>Also note the <span class='link'>sources</span> link on these pages to view the source code for the page.</p>", 060 " <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>", 061 " <p>Other features (such as this aside) are added through annotations.</p>", 062 "</div>" 063 } 064) 065@SerializerConfig( 066 // For testing purposes, we want to use single quotes in all the serializers so it's easier to do simple 067 // String comparisons. 068 // You can apply any of the Serializer/Parser/BeanContext settings this way. 069 quoteChar="'" 070) 071public class RootResources extends BasicRestServletJenaGroup { 072 // IMPORTANT! If you don't need RDF support, change the parent class to ResourceGroup. 073 // It allows you to remove the Jena prerequisite. 074 075 private static final long serialVersionUID = 1L; 076}