1 19 20 package org.netbeans.modules.web.monitor.data; 21 22 import org.w3c.dom.*; 23 import org.netbeans.modules.schema2beans.*; 24 import java.beans.*; 25 import java.util.*; 26 import javax.servlet.http.Cookie ; 27 28 public class CookieOut extends BaseBean 29 { 30 31 static Vector comparators = new Vector(); 32 33 public CookieOut() 34 { 35 this(Common.USE_DEFAULT_VALUES); 36 } 37 38 public CookieOut(Cookie cookie) { 39 super(CookieOut.comparators, new 40 org.netbeans.modules.schema2beans.Version(1, 0, 5)); 41 42 setAttributeValue("name", cookie.getName()); setAttributeValue("value", cookie.getValue()); setAttributeValue("maxAge", String.valueOf(cookie.getMaxAge())); 48 setAttributeValue("version", String.valueOf(cookie.getVersion())); 50 51 String domain = ""; try { 53 domain = cookie.getDomain(); 54 } 55 catch(NullPointerException ne) {} 56 if(domain != null) { 57 if(domain.trim().equals("")) setAttributeValue("domain", ""); else 60 setAttributeValue("domain", domain); } 62 63 String path = ""; try { 65 path = cookie.getPath(); 66 } 67 catch(NullPointerException ne) {} 68 if(path != null) { 69 if(path.trim().equals("")) setAttributeValue("path", ""); else 72 setAttributeValue("path", path); } 74 75 String comment = ""; try { 77 comment = cookie.getComment(); 78 } 79 catch(NullPointerException ne) {} 80 if(comment != null) { 81 if(comment.trim().equals("")) setAttributeValue("comment", ""); else 84 setAttributeValue("comment", comment); } 86 87 int version = cookie.getVersion(); 88 if(version != 0) setAttributeValue("version", String.valueOf(version)); 91 92 try { 93 if(cookie.getSecure()) 94 setAttributeValue("secure", String.valueOf(cookie.getSecure())); 97 98 } 99 catch(Exception exc) {} 100 } 101 102 103 public CookieOut(int options) 104 { 105 super(CookieOut.comparators, new org.netbeans.modules.schema2beans.Version(1, 0, 5)); 106 this.initialize(options); 108 } 109 110 void initialize(int options) 112 { 113 114 } 115 116 public boolean verify() 118 { 119 return true; 120 } 121 122 static public void addComparator(BeanComparator c) 124 { 125 CookieOut.comparators.add(c); 126 } 127 128 static public void removeComparator(BeanComparator c) 130 { 131 CookieOut.comparators.remove(c); 132 } 133 public void addPropertyChangeListener(PropertyChangeListener l) 135 { 136 BeanProp p = this.beanProp(); 137 if (p != null) 138 p.addPCListener(l); 139 } 140 141 public void removePropertyChangeListener(PropertyChangeListener l) 143 { 144 BeanProp p = this.beanProp(); 145 if (p != null) 146 p.removePCListener(l); 147 } 148 149 public void addPropertyChangeListener(String n, PropertyChangeListener l) 151 { 152 BeanProp p = this.beanProp(n); 153 if (p != null) 154 p.addPCListener(l); 155 } 156 157 public void removePropertyChangeListener(String n, PropertyChangeListener l) 159 { 160 BeanProp p = this.beanProp(n); 161 if (p != null) 162 p.removePCListener(l); 163 } 164 165 public void dump(StringBuffer str, String indent) 167 { 168 String s; 169 BaseBean n; 170 } 171 172 public String dumpBeanNode() 173 { 174 StringBuffer str = new StringBuffer (); 175 str.append("CookieOut\n"); this.dump(str, "\n "); return str.toString(); 178 } 179 } 180 181 | Popular Tags |