001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.ext.tag; 020 021import javax.servlet.jsp.tagext.TryCatchFinally; 022 023import lucee.loader.engine.CFMLEngineFactory; 024import lucee.runtime.exp.PageServletException; 025import lucee.runtime.util.Excepton; 026 027 028/** 029 * extends Body Support Tag eith TryCatchFinally Functionality 030 */ 031public abstract class BodyTagTryCatchFinallySupport extends BodyTagSupport implements TryCatchFinally { 032 033 /** 034 * @see javax.servlet.jsp.tagext.TryCatchFinally#doCatch(java.lang.Throwable) 035 */ 036 public void doCatch(Throwable t) throws Throwable { 037 if(t instanceof ThreadDeath) throw (ThreadDeath)t; 038 if(t instanceof PageServletException) { 039 PageServletException pse=(PageServletException)t; 040 t=pse.getPageException(); 041 } 042 if(bodyContent!=null) { 043 Excepton util = CFMLEngineFactory.getInstance().getExceptionUtil(); 044 if(util.isOfType(Excepton.TYPE_ABORT,t)) { 045 bodyContent.writeOut(bodyContent.getEnclosingWriter()); 046 } 047 bodyContent.clearBuffer(); 048 } 049 throw t; 050 } 051 052 /** 053 * @see javax.servlet.jsp.tagext.TryCatchFinally#doFinally() 054 */ 055 public void doFinally() { 056 057 } 058 059}