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