001    package railo.runtime.tag;
002    
003    import javax.servlet.jsp.tagext.Tag;
004    
005    import railo.runtime.exp.ApplicationException;
006    import railo.runtime.ext.tag.TagImpl;
007    
008    /**
009    * Required for cfhttp POST operations, cfhttpparam is used to specify the parameters necessary to 
010    *        build a cfhttp POST.
011    *
012    *
013    *
014    **/
015    public final class PDFParam extends TagImpl {
016            
017            PDFParamBean param=new PDFParamBean();
018    
019    
020            /**
021             * @param pages the pages to set
022             */
023            public void setPages(String pages) {
024                    param.setPages(pages);
025            }
026    
027            /**
028             * @param password the password to set
029             */
030            public void setPassword(String password) {
031                    param.setPassword(password);
032            }
033    
034            /**
035             * @param source the source to set
036             */
037            public void setSource(Object source) {
038                    param.setSource(source);
039            }
040            
041            
042            @Override
043            public int doStartTag() throws ApplicationException     {
044            
045            
046                    // get HTTP Tag
047                    Tag parent=getParent();
048                    while(parent!=null && !(parent instanceof PDF)) {
049                            parent=parent.getParent();
050                    }
051                    
052                    if(parent instanceof PDF) {
053                            PDF pdf = (PDF)parent;
054                            pdf.setParam(param);
055                    }
056                    else {
057                            throw new ApplicationException("Wrong Context, tag PDFParam must be inside a PDF tag"); 
058                    }
059                    return SKIP_BODY;
060            }
061    
062            @Override
063            public int doEndTag()   {
064                    return EVAL_PAGE;
065            }
066    
067            @Override
068            public void release()   {
069                    super.release();
070                    param=new PDFParamBean();
071            }
072    }