private RewriteRule parseRule(OMElement ruleElement) { Iterator actions = ruleElement.getChildrenWithName(ACTION_Q); if (actions == null) { handleException("At least one rewrite action is required per rule"); return null; } RewriteRule rule = new RewriteRule(); while (actions.hasNext()) { rule.addRewriteAction(parseAction((OMElement) actions.next())); } OMElement condition = ruleElement.getFirstChildWithName(CONDITION_Q); if (condition != null) { OMElement child = condition.getFirstElement(); if (child != null) { try { Evaluator eval = EvaluatorFactoryFinder.getInstance().getEvaluator(child); rule.setCondition(eval); } catch (EvaluatorException e) { handleException("Error while parsing the rule condition", e); } } } return rule; }
private RewriteRule parseRule(OMElement ruleElement) { Iterator actions = ruleElement.getChildrenWithName(ACTION_Q); if (actions == null) { handleException("At least one rewrite action is required per rule"); return null; } RewriteRule rule = new RewriteRule(); while (actions.hasNext()) { rule.addRewriteAction(parseAction((OMElement) actions.next())); } OMElement condition = ruleElement.getFirstChildWithName(CONDITION_Q); if (condition != null) { OMElement child = condition.getFirstElement(); if (child != null) { try { Evaluator eval = EvaluatorFactoryFinder.getInstance().getEvaluator(child); rule.setCondition(eval); } catch (EvaluatorException e) { handleException("Error while parsing the rule condition", e); } } } return rule; }
handleException("value or xpath attribute is required on the action element"); action.setXpath(SynapseXPathFactory.getSynapseXPath(actionElement, xpath_Q)); } catch (JaxenException e) { handleException("Error while parsing the XPath expression: " + xpath, e); action.setFragmentIndex(URIFragments.FULL_URI); } else { handleException("Unknown URL fragment name: " + fragment); action.setRegex(regex); } else { handleException("regex attribute is required for replace action"); handleException("Unknown URL rewrite action type: " + type);
handleException("value or xpath attribute is required on the action element"); action.setXpath(SynapseXPathFactory.getSynapseXPath(actionElement, xpath_Q)); } catch (JaxenException e) { handleException("Error while parsing the XPath expression: " + xpath, e); action.setFragmentIndex(URIFragments.FULL_URI); } else { handleException("Unknown URL fragment name: " + fragment); action.setRegex(regex); } else { handleException("regex attribute is required for replace action"); handleException("Unknown URL rewrite action type: " + type);