From 94cb657202acbbe5e45f1377ad40f29a1c6858ae Mon Sep 17 00:00:00 2001 From: Robert Godfrey Date: Fri, 18 Jul 2014 14:01:19 +0000 Subject: QPID-5903 : [Java Broker] allow character escaping for JSON in configured object attribute interpolation git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1611657 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/qpid/server/model/AbstractConfiguredObject.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'java/broker-core/src') diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java b/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java index baf20da486..41578272f7 100644 --- a/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java +++ b/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java @@ -1361,6 +1361,7 @@ public abstract class AbstractConfiguredObject> im Map inheritedContext = new HashMap(); generateInheritedContext(object.getModel(), object, inheritedContext); return Strings.expand(value, false, + JSON_SUBSTITUTION_RESOLVER, getOwnAttributeResolver(object), new Strings.MapResolver(inheritedContext), Strings.JAVA_SYS_PROPS_RESOLVER, @@ -1395,6 +1396,16 @@ public abstract class AbstractConfiguredObject> im } + private static final Strings.Resolver JSON_SUBSTITUTION_RESOLVER = + Strings.createSubstitutionResolver("json:", + new LinkedHashMap() + { + { + put("\\","\\\\"); + put("\"","\\\""); + } + }); + private static class OwnAttributeResolver implements Strings.Resolver { private static final Module _module; @@ -1432,7 +1443,7 @@ public abstract class AbstractConfiguredObject> im } @Override - public String resolve(final String variable) + public String resolve(final String variable, final Strings.Resolver resolver) { boolean clearStack = false; Set currentStack = _stack.get(); -- cgit v1.2.1