1 37 package net.thauvin.google.taglibs; 38 39 import net.thauvin.google.TagUtility; 40 41 import javax.servlet.jsp.*; 42 import javax.servlet.jsp.tagext.*; 43 44 45 64 public abstract class KeySupport extends BodyTagSupport 65 { 66 69 protected String key = null; 70 71 77 public final void setKey(String key) 78 { 79 this.key = key; 80 } 81 82 85 public void release() 86 { 87 super.release(); 88 89 key = null; 91 92 reset(); 94 } 95 96 102 protected String getKey() 103 { 104 if (TagUtility.isValidString(key, true)) 105 { 106 return key; 107 } 108 else 109 { 110 String keyParam = 111 TagUtility.getParameter(pageContext.getRequest(), 112 TagUtility.KEY_PARAM); 113 114 if (TagUtility.isValidString(keyParam, true)) 115 { 116 return keyParam; 117 } 118 119 keyParam = 120 pageContext.getServletContext().getInitParameter(TagUtility.KEY_CONTEXT_PARAM); 121 122 if (TagUtility.isValidString(keyParam, true)) 123 { 124 return keyParam; 125 } 126 127 try 128 { 129 keyParam = 130 (String )(pageContext.getAttribute(TagUtility.KEY_CONTEXT_PARAM, 131 PageContext.APPLICATION_SCOPE)); 132 133 if (TagUtility.isValidString(keyParam, true)) 134 { 135 return keyParam; 136 } 137 } 138 catch (NullPointerException e) 139 { 140 ; } 142 } 143 144 return ""; 145 } 146 147 150 protected void reset() 151 { 152 } 154 } 155 | Popular Tags |