public void setSkinfolder(String skinfolder) { if (StringUtils.isBlank(skinfolder)) { this.skinfolder = DEFAULT_SKIN_FOLDER; } else { this.skinfolder = skinfolder; } }
/* * (non-Javadoc) * * @see * net.sf.ehcache.constructs.web.filter.CachingFilter#calculateKey(javax * .servlet.http.HttpServletRequest) */ @Override protected String calculateKey(HttpServletRequest request) { // TODO Auto-generated method stub // String postId = request.getParameter("id"); String requestURI = StringUtils.encoding(request.getPathInfo(), "ISO-8859-1", "UTF-8"); if (!StringUtils.isBlank(requestURI)) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(CacheTokens.POST_CACHE_PREFIX).append(requestURI); return stringBuffer.toString(); } return null; }
/* * (non-Javadoc) * * @see * net.sf.ehcache.constructs.web.filter.CachingFilter#buildPageInfo(javax * .servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, * javax.servlet.FilterChain) */ @Override protected PageInfo buildPageInfo( HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws Exception { String key = calculateKey(request); PageInfo pageInfo = null; String originalThreadName = Thread.currentThread().getName(); try { // checkNoReentry(request); Element element = null; if (!StringUtils.isBlank(key)) { element = this.blockingCache.get(key); } if ((element == null) || (element.getObjectValue() == null)) try { pageInfo = buildPage(request, response, chain); if (pageInfo.isOk()) { log.debug( "PageInfo ok. Adding to cache " + this.blockingCache.getName() + " with key " + key); this.blockingCache.put(new Element(key, pageInfo)); } else { log.warn( "PageInfo was not ok(200). Putting null into cache " + this.blockingCache.getName() + " with key " + key); this.blockingCache.put(new Element(key, null)); } } catch (Throwable throwable) { this.blockingCache.put(new Element(key, null)); throw new Exception(throwable); } else { pageInfo = (PageInfo) element.getObjectValue(); } } catch (LockTimeoutException e) { throw e; } finally { Thread.currentThread().setName(originalThreadName); } return pageInfo; }