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 java.util.*; 20 import javax.servlet.*; 21 import javax.servlet.http.*; 22 import javax.servlet.jsp.*; 23 import javax.servlet.jsp.tagext.*; 24 25 42 43 public class CookieMaxAgeTag extends BodyTagSupport 44 { 45 46 51 public final int doStartTag() throws JspException 52 { 53 return EVAL_BODY_TAG; 54 } 55 56 61 public final int doAfterBody() throws JspException 62 { 63 BodyContent body = getBodyContent(); 65 String s = body.getString().trim(); 66 body.clearBody(); 69 70 AddCookieTag ac = null; 72 try { 73 ac = (AddCookieTag)this.findAncestorWithClass(this, 74 Class.forName("org.apache.taglibs.response.AddCookieTag")); 75 } catch(Exception e) { 76 throw new JspException("Response maxAge tag must be nested inside an addCookie tag."); 77 } 78 79 int maxage = 0; 80 try { 81 maxage = Integer.valueOf(s).intValue(); 82 } catch(NumberFormatException e) { 83 throw new JspException("Response tag maxAge value must be an integer."); 84 } 85 86 ac.setMaxAge(maxage); 88 89 return SKIP_BODY; 90 } 91 } 92
| Popular Tags
|