private BeanDefinition parseRule(Element ruleElement, ParserContext parserContext) {
BeanDefinitionBuilder ruleBuilder = BeanDefinitionBuilder.genericBeanDefinition(RewriteRule.class);
attributesToProperties(ruleElement, ruleBuilder, "pattern");
ElementSelector conditionSelector = and(sameNs(ruleElement), name("condition")); // request-contexts:condition
ElementSelector substitutionSelector = and(sameNs(ruleElement), name("substitution")); // request-contexts:substitution
ElementSelector handlersSelector = and(sameNs(ruleElement), name("handlers")); // request-contexts:handlers
List<Object> conditions = createManagedList(ruleElement, parserContext);
BeanDefinition substitution = null;
List<Object> handlers = null;
for (Element subElement : subElements(ruleElement)) {
if (conditionSelector.accept(subElement)) {
conditions.add(parseCondition(subElement, parserContext));
} else if (substitutionSelector.accept(subElement)) {
substitution = parseSubstitution(subElement, parserContext);
} else if (handlersSelector.accept(subElement)) {
handlers = parseHandlers(subElement, parserContext, ruleBuilder);
}
}
ruleBuilder.addPropertyValue("conditions", conditions);