}
@Override
public Representation represent(Variant variant)
{
StringRepresentation presentation = null;
try
{
String zkServer = (String) getContext().getAttributes().get(
RestAdminApplication.ZKSERVERADDRESS);
String clusterName = (String) getRequest().getAttributes().get(
"clusterName");
String messageType = (String) getRequest().getAttributes().get(
"MessageType");
String messageId = (String) getRequest().getAttributes().get("MessageId");
// TODO: need pass sessionId to this represent()
String sessionId = (String) getRequest().getAttributes().get("SessionId");
presentation = getControllerStatusUpdateRepresentation(zkServer,
clusterName, sessionId, messageType, messageId);
} catch (Exception e)
{
String error = ClusterRepresentationUtil
.getErrorAsJsonStringFromException(e);
presentation = new StringRepresentation(error, MediaType.APPLICATION_JSON);
LOG.error("", e);
}
return presentation;
}