Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 16 17 package org.apache.taglibs.response; 18 19 import javax.servlet.*; 20 import javax.servlet.http.*; 21 import javax.servlet.jsp.*; 22 import javax.servlet.jsp.tagext.*; 23 24 84 85 public class AddCookieTag extends TagSupport 86 { 87 private Cookie cookie = null; 88 private String name = null; 89 private String value = null; 90 private String comment = null; 91 private String domain = null; 92 private int maxAge = -1; 93 private String path = null; 94 private boolean secure = false; 95 private int version = 0; 96 97 102 public final int doStartTag() throws JspException 103 { 104 cookie = new Cookie(name,""); 105 return EVAL_BODY_INCLUDE; 106 } 107 108 114 public final int doEndTag() throws JspException 115 { 116 if( value != null ) 118 cookie.setValue(value); 119 if( comment != null ) 120 cookie.setComment(comment); 121 if( domain != null ) 122 cookie.setDomain(domain); 123 cookie.setMaxAge(maxAge); 124 cookie.setSecure(secure); 125 cookie.setVersion(version); 126 ((HttpServletResponse)pageContext.getResponse()).addCookie(cookie); 128 129 return EVAL_PAGE; 130 } 131 132 137 public final void setComment(String com) 138 { 139 comment = com; 140 } 141 142 148 public final void setDomain(String dom) 149 { 150 domain = dom; 151 } 152 153 158 public final void setMaxAge(int max) 159 { 160 maxAge = max; 161 } 162 163 168 public final void setName(String nam) 169 { 170 name = nam; 171 } 172 173 179 public final void setPath(String pth) 180 { 181 path = pth; 182 } 183 184 189 public final void setValue(String val) 190 { 191 value = val; 192 } 193 194 201 public final void setSecure(boolean flag) 202 { 203 secure = flag; 204 } 205 206 212 public final void setVersion(int version) 213 { 214 this.version = version; 215 } 216 217 } 218
| Popular Tags
|