001    package railo.runtime.tag;
002    
003    import javax.servlet.jsp.tagext.Tag;
004    
005    import railo.runtime.exp.ApplicationException;
006    import railo.runtime.exp.PageException;
007    import railo.runtime.ext.tag.TagImpl;
008    
009    // TODO tag invokeargument
010    // attr omit
011    
012    /**
013    * Required for cfhttp POST operations, cfhttpparam is used to specify the parameters necessary to 
014    *        build a cfhttp POST.
015    *
016    *
017    *
018    **/
019    public final class InvokeArgument extends TagImpl {
020            
021            /** A variable name for the data being passed. */
022            private String name;
023    
024            /** Specifies the value of the variable being passed. */
025            private Object value;
026            private boolean omit;
027    
028            
029    
030    
031            /** set the value value
032            * @param value value to set
033            **/
034            public void setValue(Object value)      {
035                    this.value=value;
036            }
037    
038            /** set the value name
039            * @param name value to set
040            **/
041            public void setName(String name)        {
042                    this.name=name;
043            }
044    
045            /**
046             * @param omit the omit to set
047             */
048            public void setOmit(boolean omit) {
049                    this.omit = omit;
050            }
051    
052            /**
053            * @see javax.servlet.jsp.tagext.Tag#doStartTag()
054            */
055            public int doStartTag() throws PageException    {
056                    Tag parent=getParent();
057                    while(parent!=null && !(parent instanceof Invoke)) {
058                            parent=parent.getParent();
059                    }
060                    
061                    if(parent instanceof Invoke) {
062                            Invoke invoke = (Invoke)parent;
063                            invoke.setArgument(name,value);
064                    }
065                    else {
066                            throw new ApplicationException("Wrong Context, tag InvokeArgument must be inside a Invoke tag");        
067                    }
068                    return SKIP_BODY;
069            }
070    
071            /**
072            * @see javax.servlet.jsp.tagext.Tag#doEndTag()
073            */
074            public int doEndTag()   {
075                    return EVAL_PAGE;
076            }
077    
078            /**
079            * @see javax.servlet.jsp.tagext.Tag#release()
080            */
081            public void release()   {
082                    super.release();
083                    value=null;
084                    name=null;
085                    omit=false;
086            }
087    }