1 16 17 package org.apache.taglibs.request; 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 72 73 74 public class EqualsHeaderTag extends TagSupport 75 { 76 private String name = null; 77 private String match = null; 78 private boolean ignoreCase = false; 81 private boolean value = true; 82 83 90 public final int doStartTag() throws JspException 91 { 92 boolean result = false; 94 String header = ((HttpServletRequest)pageContext.getRequest()).getHeader(name); 96 97 if (header != null) { 98 if (ignoreCase) { 99 result = header.equalsIgnoreCase(match); 100 } else { 101 result = header.equals(match); 102 } 103 } 104 105 if( value == result ) 106 return EVAL_BODY_INCLUDE; 107 108 return SKIP_BODY; 109 } 110 111 116 public final void setName(String str) 117 { 118 name = str; 119 } 120 121 122 128 public final void setMatch(String str) { 129 match=str; 130 } 131 132 133 141 public final void setIgnoreCase(boolean value) { 142 ignoreCase = value; 143 } 144 145 150 public final void setValue(boolean value) 151 { 152 this.value = value; 153 } 154 155 } 156 | Popular Tags |