001    package railo.runtime.tag;
002    
003    import railo.commons.io.res.Resource;
004    import railo.runtime.exp.PageException;
005    import railo.runtime.op.Caster;
006    
007    
008    /**
009     * 
010     */
011    public final class HttpParamBean {
012    
013            /** Specifies the value of the URL, FormField, Cookie, File, or CGI variable being passed. */
014            private Object value;
015    
016            /** The transaction type. */
017            private String type;
018    
019            /** Required for type = "File". */
020            private Resource file;
021    
022            /** A variable name for the data being passed. */
023            private String name;
024            
025            private boolean encoded=true;
026        
027        private String mimeType="";
028        
029            /** set the value value
030             *  Specifies the value of the URL, FormField, Cookie, File, or CGI variable being passed.
031             * @param value value to set
032             **/
033            public void setValue(Object value) {
034                    this.value=value;
035            }
036            /** set the value type
037             *  The transaction type.
038             * @param type value to set
039             **/
040            public void setType(String type)        {
041                    this.type=type.toLowerCase().trim();
042            }
043            /** set the value file
044             *  Required for type = "File".
045             * @param file value to set
046             **/
047            public void setFile(Resource file) {
048                    this.file=file;
049            }
050            /** set the value name
051             *  A variable name for the data being passed.
052             * @param name value to set
053             **/
054            public void setName(String name){
055                    this.name=name;
056            }
057    
058            /**
059             * @return Returns the file.
060             */
061            public Resource getFile() {
062                    return file;
063            }
064            /**
065             * @return Returns the name.
066             */
067            public String getName() {
068                    return name;
069            }
070            /**
071             * @return Returns the type.
072             */
073            public String getType() {
074                    return type;
075            }
076            
077            /**
078             * @return Returns the value.
079             * @throws PageException 
080             */
081            public String getValueAsString() throws PageException {
082                    return Caster.toString(value);
083            }
084            
085            /**
086             * @return Returns the value.
087             */
088            public Object getValue()  {
089                    return value;
090            }
091        /**
092         * Returns the value of encoded.
093         * @return value encoded
094         */
095        public boolean isEncoded() {
096            return encoded;
097        }
098        /**
099         * sets the encoded value.
100         * @param encoded The encoded to set.
101         */
102        public void setEncoded(boolean encoded) {
103            this.encoded = encoded;
104        }
105        /**
106         * Returns the value of mimeType.
107         * @return value mimeType
108         */
109        public String getMimeType() {
110            return mimeType;
111        }
112        /**
113         * sets the mimeType value.
114         * @param mimeType The mimeType to set.
115         */
116        public void setMimeType(String mimeType) {
117            this.mimeType = mimeType;
118        }
119    }