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            /**
043            * @throws ApplicationException 
044             * @see javax.servlet.jsp.tagext.Tag#doStartTag()
045            */
046            public int doStartTag() throws ApplicationException     {
047            
048            
049                    // get HTTP Tag
050                    Tag parent=getParent();
051                    while(parent!=null && !(parent instanceof PDF)) {
052                            parent=parent.getParent();
053                    }
054                    
055                    if(parent instanceof PDF) {
056                            PDF pdf = (PDF)parent;
057                            pdf.setParam(param);
058                    }
059                    else {
060                            throw new ApplicationException("Wrong Context, tag PDFParam must be inside a PDF tag"); 
061                    }
062                    return SKIP_BODY;
063            }
064    
065            /**
066            * @see javax.servlet.jsp.tagext.Tag#doEndTag()
067            */
068            public int doEndTag()   {
069                    return EVAL_PAGE;
070            }
071    
072            /**
073            * @see javax.servlet.jsp.tagext.Tag#release()
074            */
075            public void release()   {
076                    super.release();
077                    param=new PDFParamBean();
078            }
079    }