1 18 19 package org.apache.struts.upload; 20 21 import java.io.File ; 22 23 34 public class MultipartElement 35 { 36 39 protected String contentType; 40 41 45 protected byte[] data; 46 47 50 protected File file; 51 52 55 protected String name; 56 57 60 protected String fileName; 61 62 63 66 protected String value; 67 68 69 72 protected boolean isFile = false; 73 74 82 public MultipartElement(String name, String fileName, 83 String contentType, File file) 84 { 85 this.name = name; 86 this.fileName = fileName; 87 this.contentType = contentType; 88 this.file = file; 89 this.isFile = true; 90 } 91 92 97 public MultipartElement(String name, String value) 98 { 99 this.name = name; 100 this.value = value; 101 this.isFile = false; 102 } 103 104 107 public String getContentType() 108 { 109 return contentType; 110 } 111 112 115 public File getFile() 116 { 117 return file; 118 } 119 120 121 124 public String getName() 125 { 126 return name; 127 } 128 129 133 public String getFileName() 134 { 135 return fileName; 136 } 137 138 139 144 public String getValue() 145 { 146 return value; 147 } 148 149 150 153 public void setFile(File file) 154 { 155 this.file = file; 156 } 157 158 159 162 public void setFileName(String fileName) 163 { 164 this.fileName = fileName; 165 } 166 167 168 171 public void setName(String name) 172 { 173 this.name = name; 174 } 175 176 177 180 public void setContentType(String contentType) 181 { 182 this.contentType = contentType; 183 } 184 185 186 189 public boolean isFile() 190 { 191 if (file == null) 192 { 193 return false; 194 } 195 return true; 196 } 197 198 199 public void setValue(String value) 200 { 201 this.value = value; 202 } 203 204 } 205 | Popular Tags |