protected int compareBranches() { String val1 = ((StringNode)left).getValue(); String val2 = ((StringNode)right).getValue(); int val2Len = val2.length(); if (val2Len > 1 && val2.charAt(0) == '/' && val2.charAt(val2Len - 1) == '/') { // Treat as a regular expression String expr = val2.substring(1, val2Len - 1); try { Pattern pattern = Pattern.compile(expr); // Regular expressions will only ever be used with EqualNode // so return zero for equal and non-zero for not equal if (pattern.matcher(val1).find()) { return 0; } else { return -1; } } catch (PatternSyntaxException pse) { ssiMediator.log("Invalid expression: " + expr, pse); return 0; } } return val1.compareTo(val2); } }
protected int compareBranches() { String val1 = ((StringNode)left).getValue(); String val2 = ((StringNode)right).getValue(); int val2Len = val2.length(); if (val2Len > 1 && val2.charAt(0) == '/' && val2.charAt(val2Len - 1) == '/') { // Treat as a regular expression String expr = val2.substring(1, val2Len - 1); try { Pattern pattern = Pattern.compile(expr); // Regular expressions will only ever be used with EqualNode // so return zero for equal and non-zero for not equal if (pattern.matcher(val1).find()) { return 0; } else { return -1; } } catch (PatternSyntaxException pse) { ssiMediator.log("Invalid expression: " + expr, pse); return 0; } } return val1.compareTo(val2); } }
protected int compareBranches() { String val1 = ((StringNode)left).getValue(); String val2 = ((StringNode)right).getValue(); int val2Len = val2.length(); if (val2Len > 1 && val2.charAt(0) == '/' && val2.charAt(val2Len - 1) == '/') { // Treat as a regular expression String expr = val2.substring(1, val2Len - 1); try { Pattern pattern = Pattern.compile(expr); // Regular expressions will only ever be used with EqualNode // so return zero for equal and non-zero for not equal if (pattern.matcher(val1).find()) { return 0; } else { return -1; } } catch (PatternSyntaxException pse) { ssiMediator.log("Invalid expression: " + expr, pse); return 0; } } return val1.compareTo(val2); } }
protected int compareBranches() { String val1 = ((StringNode)left).getValue(); String val2 = ((StringNode)right).getValue(); int val2Len = val2.length(); if (val2Len > 1 && val2.charAt(0) == '/' && val2.charAt(val2Len - 1) == '/') { // Treat as a regular expression String expr = val2.substring(1, val2Len - 1); ssiMediator.clearMatchGroups(); try { Pattern pattern = Pattern.compile(expr); // Regular expressions will only ever be used with EqualNode // so return zero for equal and non-zero for not equal Matcher matcher = pattern.matcher(val1); if (matcher.find()) { ssiMediator.populateMatchGroups(matcher); return 0; } else { return -1; } } catch (PatternSyntaxException pse) { ssiMediator.log("Invalid expression: " + expr, pse); return 0; } } return val1.compareTo(val2); } }
protected int compareBranches() { String val1 = ((StringNode)left).getValue(); String val2 = ((StringNode)right).getValue(); int val2Len = val2.length(); if (val2Len > 1 && val2.charAt(0) == '/' && val2.charAt(val2Len - 1) == '/') { // Treat as a regular expression String expr = val2.substring(1, val2Len - 1); ssiMediator.clearMatchGroups(); try { Pattern pattern = Pattern.compile(expr); // Regular expressions will only ever be used with EqualNode // so return zero for equal and non-zero for not equal Matcher matcher = pattern.matcher(val1); if (matcher.find()) { ssiMediator.populateMatchGroups(matcher); return 0; } else { return -1; } } catch (PatternSyntaxException pse) { ssiMediator.log("Invalid expression: " + expr, pse); return 0; } } return val1.compareTo(val2); } }
/** * @see SSICommand */ @Override public long process(SSIMediator ssiMediator, String commandName, String[] paramNames, String[] paramValues, PrintWriter writer) { for (int i = 0; i < paramNames.length; i++) { String paramName = paramNames[i]; String paramValue = paramValues[i]; String substitutedValue = ssiMediator .substituteVariables(paramValue); if (paramName.equalsIgnoreCase("errmsg")) { ssiMediator.setConfigErrMsg(substitutedValue); } else if (paramName.equalsIgnoreCase("sizefmt")) { ssiMediator.setConfigSizeFmt(substitutedValue); } else if (paramName.equalsIgnoreCase("timefmt")) { ssiMediator.setConfigTimeFmt(substitutedValue); } else { ssiMediator.log("#config--Invalid attribute: " + paramName); //We need to fetch this value each time, since it may change // during the // loop String configErrMsg = ssiMediator.getConfigErrMsg(); writer.write(configErrMsg); } } // Setting config options doesn't really change the page return 0; } }
/** * @see SSICommand */ public long process(SSIMediator ssiMediator, String commandName, String[] paramNames, String[] paramValues, PrintWriter writer) { for (int i = 0; i < paramNames.length; i++) { String paramName = paramNames[i]; String paramValue = paramValues[i]; String substitutedValue = ssiMediator .substituteVariables(paramValue); if (paramName.equalsIgnoreCase("errmsg")) { ssiMediator.setConfigErrMsg(substitutedValue); } else if (paramName.equalsIgnoreCase("sizefmt")) { ssiMediator.setConfigSizeFmt(substitutedValue); } else if (paramName.equalsIgnoreCase("timefmt")) { ssiMediator.setConfigTimeFmt(substitutedValue); } else { ssiMediator.log("#config--Invalid attribute: " + paramName); //We need to fetch this value each time, since it may change // during the // loop String configErrMsg = ssiMediator.getConfigErrMsg(); writer.write(configErrMsg); } } // Setting config options doesn't really change the page return 0; } }
/** * @see SSICommand */ @Override public long process(SSIMediator ssiMediator, String commandName, String[] paramNames, String[] paramValues, PrintWriter writer) { for (int i = 0; i < paramNames.length; i++) { String paramName = paramNames[i]; String paramValue = paramValues[i]; String substitutedValue = ssiMediator .substituteVariables(paramValue); if (paramName.equalsIgnoreCase("errmsg")) { ssiMediator.setConfigErrMsg(substitutedValue); } else if (paramName.equalsIgnoreCase("sizefmt")) { ssiMediator.setConfigSizeFmt(substitutedValue); } else if (paramName.equalsIgnoreCase("timefmt")) { ssiMediator.setConfigTimeFmt(substitutedValue); } else { ssiMediator.log("#config--Invalid attribute: " + paramName); //We need to fetch this value each time, since it may change // during the // loop String configErrMsg = ssiMediator.getConfigErrMsg(); writer.write(configErrMsg); } } // Setting config options doesn't really change the page return 0; } }
/** * @see SSICommand */ public long process(SSIMediator ssiMediator, String commandName, String[] paramNames, String[] paramValues, PrintWriter writer) { for (int i = 0; i < paramNames.length; i++) { String paramName = paramNames[i]; String paramValue = paramValues[i]; String substitutedValue = ssiMediator .substituteVariables(paramValue); if (paramName.equalsIgnoreCase("errmsg")) { ssiMediator.setConfigErrMsg(substitutedValue); } else if (paramName.equalsIgnoreCase("sizefmt")) { ssiMediator.setConfigSizeFmt(substitutedValue); } else if (paramName.equalsIgnoreCase("timefmt")) { ssiMediator.setConfigTimeFmt(substitutedValue); } else { ssiMediator.log("#config--Invalid attribute: " + paramName); //We need to fetch this value each time, since it may change // during the // loop String configErrMsg = ssiMediator.getConfigErrMsg(); writer.write(configErrMsg); } } // Setting config options doesn't really change the page return 0; } }
/** * @see SSICommand */ public long process(SSIMediator ssiMediator, String commandName, String[] paramNames, String[] paramValues, PrintWriter writer) { for (int i = 0; i < paramNames.length; i++) { String paramName = paramNames[i]; String paramValue = paramValues[i]; String substitutedValue = ssiMediator .substituteVariables(paramValue); if (paramName.equalsIgnoreCase("errmsg")) { ssiMediator.setConfigErrMsg(substitutedValue); } else if (paramName.equalsIgnoreCase("sizefmt")) { ssiMediator.setConfigSizeFmt(substitutedValue); } else if (paramName.equalsIgnoreCase("timefmt")) { ssiMediator.setConfigTimeFmt(substitutedValue); } else { ssiMediator.log("#config--Invalid attribute: " + paramName); //We need to fetch this value each time, since it may change // during the // loop String configErrMsg = ssiMediator.getConfigErrMsg(); writer.write(configErrMsg); } } // Setting config options doesn't really change the page return 0; } }
/** * @see SSICommand */ public long process(SSIMediator ssiMediator, String commandName, String[] paramNames, String[] paramValues, PrintWriter writer) { for (int i = 0; i < paramNames.length; i++) { String paramName = paramNames[i]; String paramValue = paramValues[i]; String substitutedValue = ssiMediator .substituteVariables(paramValue); if (paramName.equalsIgnoreCase("errmsg")) { ssiMediator.setConfigErrMsg(substitutedValue); } else if (paramName.equalsIgnoreCase("sizefmt")) { ssiMediator.setConfigSizeFmt(substitutedValue); } else if (paramName.equalsIgnoreCase("timefmt")) { ssiMediator.setConfigTimeFmt(substitutedValue); } else { ssiMediator.log("#config--Invalid attribute: " + paramName); //We need to fetch this value each time, since it may change // during the // loop String configErrMsg = ssiMediator.getConfigErrMsg(); writer.write(configErrMsg); } } // Setting config options doesn't really change the page return 0; } }
/** * @see SSICommand */ @Override public long process(SSIMediator ssiMediator, String commandName, String[] paramNames, String[] paramValues, PrintWriter writer) { for (int i = 0; i < paramNames.length; i++) { String paramName = paramNames[i]; String paramValue = paramValues[i]; String substitutedValue = ssiMediator .substituteVariables(paramValue); if (paramName.equalsIgnoreCase("errmsg")) { ssiMediator.setConfigErrMsg(substitutedValue); } else if (paramName.equalsIgnoreCase("sizefmt")) { ssiMediator.setConfigSizeFmt(substitutedValue); } else if (paramName.equalsIgnoreCase("timefmt")) { ssiMediator.setConfigTimeFmt(substitutedValue); } else { ssiMediator.log("#config--Invalid attribute: " + paramName); //We need to fetch this value each time, since it may change // during the // loop String configErrMsg = ssiMediator.getConfigErrMsg(); writer.write(configErrMsg); } } // Setting config options doesn't really change the page return 0; } }
/** * @see SSICommand */ @Override public long process(SSIMediator ssiMediator, String commandName, String[] paramNames, String[] paramValues, PrintWriter writer) { for (int i = 0; i < paramNames.length; i++) { String paramName = paramNames[i]; String paramValue = paramValues[i]; String substitutedValue = ssiMediator .substituteVariables(paramValue); if (paramName.equalsIgnoreCase("errmsg")) { ssiMediator.setConfigErrMsg(substitutedValue); } else if (paramName.equalsIgnoreCase("sizefmt")) { ssiMediator.setConfigSizeFmt(substitutedValue); } else if (paramName.equalsIgnoreCase("timefmt")) { ssiMediator.setConfigTimeFmt(substitutedValue); } else { ssiMediator.log("#config--Invalid attribute: " + paramName); //We need to fetch this value each time, since it may change // during the // loop String configErrMsg = ssiMediator.getConfigErrMsg(); writer.write(configErrMsg); } } // Setting config options doesn't really change the page return 0; } }
/** * @see SSICommand */ public long process(SSIMediator ssiMediator, String commandName, String[] paramNames, String[] paramValues, PrintWriter writer) { for (int i = 0; i < paramNames.length; i++) { String paramName = paramNames[i]; String paramValue = paramValues[i]; String substitutedValue = ssiMediator .substituteVariables(paramValue); if (paramName.equalsIgnoreCase("errmsg")) { ssiMediator.setConfigErrMsg(substitutedValue); } else if (paramName.equalsIgnoreCase("sizefmt")) { ssiMediator.setConfigSizeFmt(substitutedValue); } else if (paramName.equalsIgnoreCase("timefmt")) { ssiMediator.setConfigTimeFmt(substitutedValue); } else { ssiMediator.log("#config--Invalid attribute: " + paramName); //We need to fetch this value each time, since it may change // during the // loop String configErrMsg = ssiMediator.getConfigErrMsg(); writer.write(HtmlEntityEncoder.encodeXSS(configErrMsg)); } } // Setting config options doesn't really change the page return 0; } }
/** * @see SSICommand */ public long process(SSIMediator ssiMediator, String commandName, String[] paramNames, String[] paramValues, PrintWriter writer) { for (int i = 0; i < paramNames.length; i++) { String paramName = paramNames[i]; String paramValue = paramValues[i]; String substitutedValue = ssiMediator .substituteVariables(paramValue); if (paramName.equalsIgnoreCase("errmsg")) { ssiMediator.setConfigErrMsg(substitutedValue); } else if (paramName.equalsIgnoreCase("sizefmt")) { ssiMediator.setConfigSizeFmt(substitutedValue); } else if (paramName.equalsIgnoreCase("timefmt")) { ssiMediator.setConfigTimeFmt(substitutedValue); } else { ssiMediator.log(MESSAGES.ssiInvalidAttribute("config", paramName)); //We need to fetch this value each time, since it may change // during the // loop String configErrMsg = ssiMediator.getConfigErrMsg(); writer.write(configErrMsg); } } // Setting config options doesn't really change the page return 0; } }