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.server.view.jsp; 018 019import org.apache.juneau.rest.server.*; 020import org.apache.juneau.rest.server.view.*; 021 022/** 023 * Child-resource flavor of the {@link JspMixin} mixin. 024 * 025 * <p> 026 * Mounts as a <b>routed child</b> via {@link Rest#children() @Rest(children=JspResource.class)} under a 027 * parent at the subtree {@code /jsp} and serves raw {@code .jsp} resources by delegating to a shared 028 * {@link JspDispatcher} worker — the same flavor-neutral {@link RawTemplateDispatcher} 029 * implementation the {@link JspMixin mixin} and {@link JspServlet servlet} flavors hold, so the three 030 * forms cannot drift. 031 * 032 * <h5 class='section'>See Also:</h5><ul> 033 * <li class='jc'>{@link JspMixin} 034 * <li class='jc'>{@link JspServlet} 035 * <li class='jc'>{@link ViewResource} 036 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JspViewSupport">JSP View Support</a> 037 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/RestServerComposition">REST Server — Mixins and Multi-Mount Paths</a> 038 * </ul> 039 * 040 * @since 10.0.0 041 */ 042@Rest( 043 path="/jsp", 044 responseProcessors={JspViewRenderer.class} 045) 046public class JspResource extends ViewResource { 047 048 private final JspDispatcher worker; 049 050 /** No-arg constructor — uses a default {@link JspDispatcher} worker. */ 051 public JspResource() { 052 this(JspDispatcher.create().build()); 053 } 054 055 /** 056 * Worker constructor. 057 * 058 * @param worker The shared flavor-neutral JSP dispatcher this child delegates raw dispatch to. 059 * Must not be {@code null}. 060 */ 061 protected JspResource(JspDispatcher worker) { 062 this.worker = worker; 063 } 064 065 @Override /* ViewResource */ 066 protected RawTemplateDispatcher dispatcher() { 067 return worker; 068 } 069}