[ARTEMIS-1947] Session metadata in session management operation

Fill the session's metadata in JSON properties instead of serializing it
as an opaque String.

JIRA: https://issues.apache.org/jira/browse/ARTEMIS-1947
This commit is contained in:
Jeff Mesnil 2018-08-06 14:11:40 +02:00
parent d13b42def7
commit fd9aad202b
1 changed files with 6 additions and 4 deletions

View File

@ -1923,10 +1923,12 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
obj.add("principal", sess.getValidatedUser());
}
String metadata = sess.getMetaData() == null ? null : sess.getMetaData().toString();
if (metadata != null) {
// remove leading and trailing curly brackets
obj.add("metadata", metadata.substring(1, metadata.length() - 1));
if (sess.getMetaData() != null) {
final JsonObjectBuilder metadata = JsonLoader.createObjectBuilder();
for (Entry<String, String> entry : sess.getMetaData().entrySet()) {
metadata.add(entry.getKey(), entry.getValue());
}
obj.add("metadata", metadata);
}
array.add(obj);