001/* 002 * Shredzone Commons 003 * 004 * Copyright (C) 2012 Richard "Shred" Körber 005 * http://commons.shredzone.org 006 * 007 * This program is free software: you can redistribute it and/or modify 008 * it under the terms of the GNU Library General Public License as 009 * published by the Free Software Foundation, either version 3 of the 010 * License, or (at your option) any later version. 011 * 012 * This program is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 015 * GNU General Public License for more details. 016 * 017 * You should have received a copy of the GNU Library General Public License 018 * along with this program. If not, see <http://www.gnu.org/licenses/>. 019 */ 020package org.shredzone.commons.taglib.proxy; 021 022import java.io.IOException; 023 024import javax.servlet.jsp.JspContext; 025import javax.servlet.jsp.JspException; 026import javax.servlet.jsp.tagext.JspFragment; 027import javax.servlet.jsp.tagext.JspTag; 028import javax.servlet.jsp.tagext.SimpleTag; 029 030/** 031 * A proxy that implements {@link SimpleTag} and allows the target implementation to use 032 * dependency injection. 033 * 034 * @param <T> 035 * Type of the {@link SimpleTag} this proxy delegates to 036 * @author Richard "Shred" Körber 037 */ 038public abstract class SimpleTagProxy<T extends SimpleTag> extends AbstractTagProxy<T> implements SimpleTag { 039 040 @Override 041 public void doTag() throws JspException, IOException { 042 getTargetBean().doTag(); 043 } 044 045 @Override 046 public JspTag getParent() { 047 return getTargetBean().getParent(); 048 } 049 050 @Override 051 public void setJspBody(JspFragment jspBody) { 052 getTargetBean().setJspBody(jspBody); 053 } 054 055 @Override 056 public void setJspContext(JspContext pc) { 057 initTargetBean(pc); 058 getTargetBean().setJspContext(pc); 059 } 060 061 @Override 062 public void setParent(JspTag parent) { 063 getTargetBean().setParent(parent); 064 } 065 066}