use of org.apache.knox.gateway.filter.rewrite.api.UrlRewriteFilterApplyDescriptor in project knox by apache.
the class XmlFilterReader method processCharacters.
private void processCharacters(Characters event) throws XPathExpressionException {
// System.out.println( "T[" + event.isCData() + "," + event.isWhiteSpace() + "," + event.isIgnorableWhiteSpace() + "]=" + event );
Level level = stack.peek();
Node node = stack.peek().node;
if (event.isCData()) {
node.appendChild(document.createCDATASection(event.getData()));
} else {
node.appendChild(document.createTextNode(event.getData()));
}
if (!currentlyBuffering()) {
String value = event.getData();
if (!event.isWhiteSpace()) {
if (level.scopeConfig == null || level.scopeConfig.getSelectors().isEmpty()) {
value = filterText(extractQName(node), value, null);
} else {
UrlRewriteFilterPathDescriptor path = pickFirstMatchingPath(level);
if (path instanceof UrlRewriteFilterApplyDescriptor) {
String rule = ((UrlRewriteFilterApplyDescriptor) path).rule();
value = filterText(extractQName(node), value, rule);
}
}
}
if (event.isCData()) {
writer.write("<![CDATA[");
writer.write(value);
writer.write("]]>");
} else {
writer.write(StringEscapeUtils.escapeXml(value));
}
}
}
Aggregations