Methods Summary |
---|
public static int | convertScope(java.lang.String scope)
int ret;
if (REQUEST_SCOPE.equalsIgnoreCase(scope)) {
ret = PageContext.REQUEST_SCOPE;
} else if (SESSION_SCOPE.equalsIgnoreCase(scope)) {
ret = PageContext.SESSION_SCOPE;
} else if (APPLICATION_SCOPE.equalsIgnoreCase(scope)) {
ret = PageContext.APPLICATION_SCOPE;
} else {
String msg = _rb.getString("taglibs.cache.illegalScope");
msg = MessageFormat.format(msg, new Object[] { scope });
throw new IllegalArgumentException(msg);
}
return ret;
|
public static java.lang.String | generateKey(java.lang.String key, javax.servlet.jsp.PageContext pc)This function generates the key to the cache. It creates the key
by suffixing the servlet path with either the user-specified key or
by keeping a counter in the request attribute which it will
increment each time so that multiple cache tags in a page each get
a unique key.
HttpServletRequest req = (HttpServletRequest)pc.getRequest();
// use the key as the suffix by default
String suffix = key;
if (suffix == null) {
String saved = (String)req.getAttribute(Constants.JSPTAG_COUNTER_KEY);
if (saved == null)
suffix = "1";
else
suffix = Integer.toString(Integer.parseInt(saved) + 1);
req.setAttribute(Constants.JSPTAG_COUNTER_KEY, suffix);
}
// concatenate the servlet path and the suffix to generate key
return req.getServletPath() + '_" + suffix;
|
public static com.sun.appserv.util.cache.Cache | getCache(javax.servlet.jsp.PageContext pc, int scope)This is used to get the cache itself. The cache is stored as an
attribute in the specified scope.
return (Cache)pc.getAttribute(Constants.JSPTAG_CACHE_KEY, scope);
|