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 javax.servlet.jsp.tagext.Tag; 022 023import lucee.runtime.exp.ApplicationException; 024import lucee.runtime.ext.tag.TagImpl; 025 026/** 027* Required for cfhttp POST operations, cfhttpparam is used to specify the parameters necessary to 028* build a cfhttp POST. 029* 030* 031* 032**/ 033public final class PDFParam extends TagImpl { 034 035 PDFParamBean param=new PDFParamBean(); 036 037 038 /** 039 * @param pages the pages to set 040 */ 041 public void setPages(String pages) { 042 param.setPages(pages); 043 } 044 045 /** 046 * @param password the password to set 047 */ 048 public void setPassword(String password) { 049 param.setPassword(password); 050 } 051 052 /** 053 * @param source the source to set 054 */ 055 public void setSource(Object source) { 056 param.setSource(source); 057 } 058 059 060 @Override 061 public int doStartTag() throws ApplicationException { 062 063 064 // get HTTP Tag 065 Tag parent=getParent(); 066 while(parent!=null && !(parent instanceof PDF)) { 067 parent=parent.getParent(); 068 } 069 070 if(parent instanceof PDF) { 071 PDF pdf = (PDF)parent; 072 pdf.setParam(param); 073 } 074 else { 075 throw new ApplicationException("Wrong Context, tag PDFParam must be inside a PDF tag"); 076 } 077 return SKIP_BODY; 078 } 079 080 @Override 081 public int doEndTag() { 082 return EVAL_PAGE; 083 } 084 085 @Override 086 public void release() { 087 super.release(); 088 param=new PDFParamBean(); 089 } 090}