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