1 16 package org.apache.cocoon.environment.portlet; 17 18 import org.apache.cocoon.environment.Cookie; 19 20 29 public final class PortletCookie implements Cookie { 30 31 private String name; 32 private String value; 33 34 public PortletCookie(String name, String value) { 35 init(name, value); 36 } 37 38 45 public void init(String name, String value) { 46 if (this.name == null) { 47 this.name = name; 48 this.value = value; 49 } else { 50 throw new IllegalStateException ("Cookie is already initialised"); 51 } 52 } 53 54 private void checkState() { 55 if (this.name == null) { 56 throw new IllegalStateException ("Cookie is not initialised"); 57 } 58 } 59 60 63 public void setComment(String purpose) { 64 } 65 66 70 public String getComment() { 71 checkState(); 72 return null; 73 } 74 75 78 public void setDomain(String pattern) { 79 checkState(); 80 } 81 82 86 public String getDomain() { 87 checkState(); 88 return null; 89 } 90 91 94 public void setMaxAge(int expiry) { 95 checkState(); 96 } 97 98 102 public int getMaxAge() { 103 checkState(); 104 return Integer.MAX_VALUE; 105 } 106 107 110 public void setPath(String uri) { 111 checkState(); 112 } 113 114 118 public String getPath() { 119 checkState(); 120 return ""; 121 } 122 123 127 public void setSecure(boolean flag) { 128 checkState(); 129 } 130 131 135 public boolean getSecure() { 136 checkState(); 137 return false; 138 } 139 140 146 public String getName() { 147 checkState(); 148 return this.name; 149 } 150 151 165 public void setValue(String newValue) { 166 checkState(); 167 this.value = newValue; 168 } 169 170 178 public String getValue() { 179 checkState(); 180 return this.value; 181 } 182 183 190 public int getVersion() { 191 checkState(); 192 return 0; 193 } 194 195 202 public void setVersion(int v) { 203 checkState(); 204 } 205 } 206 | Popular Tags |