public int doStartTag() throws JspException { boolean result = false; try { result = ContextUtils.getPsnRuleEngine((HttpServletRequest) pageContext.getRequest()).eval(rule); } catch (Exception e) { logger.error("Error evaluating personalization rule defined in JSP: \"" + rule + "\"", e); } if (result) return EVAL_BODY_BUFFERED; else return SKIP_BODY; }
public static ReturnDef getReturnDef(ArrayList<ReturnDef> defs) { if (defs == null || defs.size() == 0) return null; PsnRuleEngine rule = ContextUtils.getPsnRuleEngine(ContextUtils.getRequest()); for (ReturnDef def : defs) { try { if (def.getRule() == null) return def; if (rule.eval(def.getRule())) return def; } catch (Exception e) { logger.error("Error evaluating psn rule \"" + def.getRule() + "\"", e); return null; } } return null; }