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            @Override
053            public int doStartTag() throws PageException    {
054                    Tag parent=getParent();
055                    while(parent!=null && !(parent instanceof Invoke)) {
056                            parent=parent.getParent();
057                    }
058                    
059                    if(parent instanceof Invoke) {
060                            Invoke invoke = (Invoke)parent;
061                            invoke.setArgument(name,value);
062                    }
063                    else {
064                            throw new ApplicationException("Wrong Context, tag InvokeArgument must be inside a Invoke tag");        
065                    }
066                    return SKIP_BODY;
067            }
068    
069            @Override
070            public int doEndTag()   {
071                    return EVAL_PAGE;
072            }
073    
074            @Override
075            public void release()   {
076                    super.release();
077                    value=null;
078                    name=null;
079                    omit=false;
080            }
081    }