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 40 41 public class SetDateHeaderTag extends BodyTagSupport 42 { 43 private String name = null; 44 45 50 public final int doStartTag() throws JspException 51 { 52 return EVAL_BODY_TAG; 53 } 54 55 60 public final int doAfterBody() throws JspException 61 { 62 BodyContent body = getBodyContent(); 64 String s = body.getString().trim(); 65 body.clearBody(); 68 69 long value = 0; 70 try { 71 value = Long.valueOf(s).longValue(); 72 } catch(NumberFormatException e) { 73 throw new JspException("Response tag setDateHeader: " + 74 e.getMessage()); 75 } 76 77 ((HttpServletResponse)pageContext.getResponse()).setDateHeader(name,value); 78 return SKIP_BODY; 79 } 80 81 86 public final void setName(String nam) 87 { 88 name = nam; 89 } 90 91 } 92 | Popular Tags |