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.rest.widget;
018
019import org.apache.juneau.*;
020import org.apache.juneau.rest.*;
021
022/**
023 * Widget that places a powered-by-Apache message on the page.
024 *
025 * <p>
026 * The variable it resolves is <js>"$W{PoweredByApache}"</js>.
027 *
028 * <p>
029 * It produces a simple Apache icon floating on the right.
030 * Typically it's used in the footer of the page, as shown below in the <c>RootResources</c> from the examples:
031 *
032 * <p class='bjava'>
033 *    <ja>@Rest</ja>(
034 *       path=<js>"/"</js>,
035 *       title=<js>"Root resources"</js>,
036 *       description=<js>"Example of a router resource page."</js>
037 *    )
038 *  <ja>@HtmlDocConfig</ja>(
039 *       widgets={
040 *          PoweredByApache.<jk>class</jk>
041 *       },
042 *       footer=<js>"$W{PoweredByApache}"</js>
043 *    )
044 * </p>
045 *
046 * <p>
047 * It renders the following image:
048 * <img class='bordered' src='doc-files/PoweredByApacheWidget.png'>
049 *
050 * <h5 class='section'>See Also:</h5><ul>
051 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/HtmlPredefinedWidgets">Predefined Widgets</a>
052 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/HtmlWidgets">Widgets</a>
053 * </ul>
054 */
055public class PoweredByApache extends Widget {
056
057   /**
058    * Returns an Apache image tag hyperlinked to <js>"http://apache.org"</js>
059    */
060   @Override /* Widget */
061   public String getHtml(RestRequest req, RestResponse res) {
062      UriResolver r = req.getUriResolver();
063      return "<a href='http://apache.org'><img style='float:right;padding-right:20px;height:32px' src='"+r.resolve("servlet:/htdocs/asf.png")+"'>";
064   }
065}