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.tag; 020 021import lucee.runtime.exp.PageException; 022import lucee.runtime.ext.tag.BodyTagImpl; 023import lucee.runtime.op.Caster; 024 025public final class Setting extends BodyTagImpl { 026 027 private boolean hasBody; 028 029 /** set the value requesttimeout 030 * @param requesttimeout value to set 031 **/ 032 public void setRequesttimeout(double requesttimeout) { 033 034 if (requesttimeout <= 0) 035 pageContext.setRequestTimeout(Long.MAX_VALUE); 036 else 037 pageContext.setRequestTimeout((long)(requesttimeout*1000)); 038 } 039 040 /** set the value showdebugoutput 041 * Yes or No. When set to No, showDebugOutput suppresses debugging information that would 042 * otherwise display at the end of the generated page.Default is Yes. 043 * @param showdebugoutput value to set 044 **/ 045 public void setShowdebugoutput(boolean showdebugoutput) { 046 if(pageContext.getConfig().debug())pageContext.getDebugger().setOutput(showdebugoutput); 047 } 048 049 /** set the value enablecfoutputonly 050 * Yes or No. When set to Yes, cfsetting blocks output of HTML that resides outside cfoutput tags. 051 * @param enablecfoutputonly value to set 052 * @throws PageException 053 **/ 054 public void setEnablecfoutputonly(Object enablecfoutputonly) throws PageException { 055 if(enablecfoutputonly instanceof String && 056 Caster.toString(enablecfoutputonly).trim().equalsIgnoreCase("reset")) { 057 pageContext.setCFOutputOnly((short)0); 058 } 059 else { 060 pageContext.setCFOutputOnly(Caster.toBooleanValue(enablecfoutputonly)); 061 } 062 } 063 064 /** 065 * @deprecated this method is replaced by the method <code>setEnablecfoutputonly(Object enablecfoutputonly)</code> 066 * @param enablecfoutputonly 067 */ 068 public void setEnablecfoutputonly(boolean enablecfoutputonly) { 069 pageContext.setCFOutputOnly(enablecfoutputonly); 070 } 071 072 @Override 073 public int doStartTag() { 074 return EVAL_BODY_INCLUDE; 075 } 076 077 @Override 078 public int doEndTag() { 079 return EVAL_PAGE; 080 } 081 082 /** 083 * sets if tag has a body or not 084 * @param hasBody 085 */ 086 public void hasBody(boolean hasBody) { 087 this.hasBody=hasBody; 088 } 089 090}