1 23 24 package com.sun.appserv.web.taglibs.cache; 25 26 import java.util.ResourceBundle ; 27 import java.util.logging.Logger ; 28 import java.util.logging.Level ; 29 30 import javax.servlet.jsp.*; 31 import javax.servlet.jsp.tagext.*; 32 33 import com.sun.enterprise.web.logging.pwc.LogDomains; 34 35 import com.sun.appserv.util.cache.Cache; 36 37 46 public class FlushTag extends TagSupport 47 { 48 51 private String _key; 52 53 56 private int _scope = PageContext.APPLICATION_SCOPE; 57 58 61 private static Logger _logger = null; 62 63 66 private static boolean _debugLog; 67 68 71 private static ResourceBundle _rb = null; 72 73 76 80 public FlushTag() { 81 super(); 82 if (_logger == null) { 83 _logger = LogDomains.getLogger(LogDomains.PWC_LOGGER); 84 _rb = _logger.getResourceBundle(); 85 _debugLog = _logger.isLoggable(Level.FINE); 86 } 87 } 88 89 92 99 public int doStartTag() 100 throws JspException 101 { 102 Cache cache = CacheUtil.getCache(pageContext, _scope); 104 105 107 if (_key != null) { 108 String key = CacheUtil.generateKey(_key, pageContext); 109 110 cache.remove(key); 112 113 if (_debugLog) 114 _logger.fine("FlushTag: clear ["+ key +"]"); 115 } else { 116 cache.clear(); 118 119 if (_debugLog) 120 _logger.fine("FlushTag: clear cache"); 121 } 122 123 return SKIP_BODY; 124 } 125 126 132 public int doEndTag() 133 throws JspException 134 { 135 _key = null; 136 _scope = PageContext.APPLICATION_SCOPE; 137 138 return EVAL_PAGE; 139 } 140 141 144 147 public void setKey(String key) { 148 if (key != null && key.length() > 0) 149 _key = key; 150 } 151 152 160 public void setScope(String scope) { 161 _scope = CacheUtil.convertScope(scope); 162 } 163 } 164 | Popular Tags |