001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.tag; 020 021import lucee.commons.io.res.Resource; 022import lucee.runtime.exp.PageException; 023import lucee.runtime.op.Caster; 024 025 026/** 027 * 028 */ 029public final class HttpParamBean { 030 031 /** Specifies the value of the URL, FormField, Cookie, File, or CGI variable being passed. */ 032 private Object value; 033 034 /** The transaction type. */ 035 private String type; 036 037 /** Required for type = "File". */ 038 private Resource file; 039 040 /** A variable name for the data being passed. */ 041 private String name; 042 043 private boolean encoded=true; 044 045 private String mimeType=""; 046 047 /** set the value value 048 * Specifies the value of the URL, FormField, Cookie, File, or CGI variable being passed. 049 * @param value value to set 050 **/ 051 public void setValue(Object value) { 052 this.value=value; 053 } 054 /** set the value type 055 * The transaction type. 056 * @param type value to set 057 **/ 058 public void setType(String type) { 059 this.type=type.toLowerCase().trim(); 060 } 061 /** set the value file 062 * Required for type = "File". 063 * @param file value to set 064 **/ 065 public void setFile(Resource file) { 066 this.file=file; 067 } 068 /** set the value name 069 * A variable name for the data being passed. 070 * @param name value to set 071 **/ 072 public void setName(String name){ 073 this.name=name; 074 } 075 076 /** 077 * @return Returns the file. 078 */ 079 public Resource getFile() { 080 return file; 081 } 082 /** 083 * @return Returns the name. 084 */ 085 public String getName() { 086 return name; 087 } 088 /** 089 * @return Returns the type. 090 */ 091 public String getType() { 092 return type; 093 } 094 095 /** 096 * @return Returns the value. 097 * @throws PageException 098 */ 099 public String getValueAsString() throws PageException { 100 return Caster.toString(value); 101 } 102 103 /** 104 * @return Returns the value. 105 */ 106 public Object getValue() { 107 return value; 108 } 109 /** 110 * Returns the value of encoded. 111 * @return value encoded 112 */ 113 public boolean getEncoded() { 114 return encoded; 115 } 116 /** 117 * sets the encoded value. 118 * @param encoded The encoded to set. 119 */ 120 public void setEncoded(boolean encoded) { 121 this.encoded = encoded; 122 } 123 /** 124 * Returns the value of mimeType. 125 * @return value mimeType 126 */ 127 public String getMimeType() { 128 return mimeType; 129 } 130 /** 131 * sets the mimeType value. 132 * @param mimeType The mimeType to set. 133 */ 134 public void setMimeType(String mimeType) { 135 this.mimeType = mimeType; 136 } 137}