1 18 19 package org.apache.jmeter.protocol.http.control; 20 21 import java.io.Serializable ; 22 23 import org.apache.jmeter.config.ConfigElement; 24 import org.apache.jmeter.testelement.AbstractTestElement; 25 import org.apache.jmeter.testelement.property.BooleanProperty; 26 import org.apache.jmeter.testelement.property.LongProperty; 27 import org.apache.jorphan.util.JOrphanUtils; 28 29 34 public class Cookie extends AbstractTestElement implements Serializable 35 { 36 private static String VALUE = "Cookie.value"; 37 private static String DOMAIN = "Cookie.domain"; 38 private static String EXPIRES = "Cookie.expires"; 39 private static String SECURE = "Cookie.secure"; 40 private static String PATH = "Cookie.path"; 41 42 45 public Cookie() 46 { 47 this.setName(""); 48 this.setValue(""); 49 this.setDomain(""); 50 this.setPath(""); 51 this.setSecure(false); 52 this.setExpires(0); 53 } 54 55 58 public Cookie( 59 String name, 60 String value, 61 String domain, 62 String path, 63 boolean secure, 64 long expires) 65 { 66 this.setName(name); 67 this.setValue(value); 68 this.setDomain(domain); 69 this.setPath(path); 70 this.setSecure(secure); 71 this.setExpires(expires); 72 } 73 74 public void addConfigElement(ConfigElement config) 75 { 76 } 77 78 public boolean expectsModification() 79 { 80 return false; 81 } 82 83 public String getClassLabel() 84 { 85 return "Cookie"; 86 } 87 88 91 public synchronized String getValue() 92 { 93 return getPropertyAsString(VALUE); 94 } 95 96 99 public synchronized void setValue(String value) 100 { 101 this.setProperty(VALUE, value); 102 } 103 104 107 public synchronized String getDomain() 108 { 109 return getPropertyAsString(DOMAIN); 110 } 111 112 115 public synchronized void setDomain(String domain) 116 { 117 setProperty(DOMAIN, domain); 118 } 119 120 123 public synchronized long getExpires() 124 { 125 return getPropertyAsLong(EXPIRES); 126 } 127 128 131 public synchronized void setExpires(long expires) 132 { 133 setProperty(new LongProperty(EXPIRES, expires)); 134 } 135 136 139 public synchronized boolean getSecure() 140 { 141 return getPropertyAsBoolean(SECURE); 142 } 143 144 147 public synchronized void setSecure(boolean secure) 148 { 149 setProperty(new BooleanProperty(SECURE, secure)); 150 } 151 152 155 public synchronized String getPath() 156 { 157 return getPropertyAsString(PATH); 158 } 159 160 163 public synchronized void setPath(String path) 164 { 165 setProperty(PATH, path); 166 } 167 168 171 public String toString() 172 { 173 return getDomain() 174 + "\tTRUE\t" 175 + getPath() 176 + "\t" 177 + JOrphanUtils.booleanToSTRING(getSecure()) 178 + "\t" 179 + getExpires() 180 + "\t" 181 + getName() 182 + "\t" 183 + getValue(); 184 } 185 } 186 | Popular Tags |