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