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.petstore.console.dev; 018 019import org.apache.juneau.http.response.*; 020import org.apache.juneau.petstore.console.*; 021import org.apache.juneau.petstore.console.dev.flavors.*; 022import org.apache.juneau.rest.server.*; 023 024/** 025 * The petstore console's Developer section: custom cards, themes, rendering flavors and the secure API demo. 026 * 027 * <p> 028 * Mounted under {@link PetstoreConsoleResource} at {@code /console/dev}. Each page is its own child resource. 029 * 030 * <h5 class='section'>Example:</h5> 031 * <p class='bjava'> 032 * <jc>// Mounted as a child of the console root.</jc> 033 * <ja>@Rest</ja>(path=<js>"/console"</js>, children={StoreRest.<jk>class</jk>, DevRest.<jk>class</jk>}) 034 * <jk>public class</jk> PetstoreConsoleResource <jk>extends</jk> PetstoreConsolePage { ... } 035 * 036 * <jc>// GET /console/dev -> 303 to /console/dev/cards</jc> 037 * </p> 038 */ 039@Rest(path="/dev", title="Developer", children={ 040 ChartsRest.class, CustomCardsRest.class, DashboardRest.class, DataRest.class, FlavorsRest.class, SecureRest.class, ThemesRest.class 041}) 042@SuppressWarnings({ 043 "java:S110" // Inheritance depth comes from the BasicRestServlet hierarchy, not this page. 044}) 045public class DevRest extends PetstoreConsolePage { 046 047 private static final long serialVersionUID = 1L; 048 049 /** 050 * Redirects the section root to its first child. 051 * 052 * @param req The request. 053 * @return A 303 to {@code cards}. 054 */ 055 @RestGet(path="/") 056 public SeeOther index(RestRequest req) { 057 return new SeeOther().setLocation(req.getUriResolver().resolve("servlet:/cards")); 058 } 059}