final ActionReport report = context.getActionReport();
ActionReport.MessagePart part = report.getTopMessagePart();
HttpService httpService = null;
HostAndPort hostAndPort = null;
try {
if (config == null) {
throw new Exception("No such target:" + target);
}
httpService = config.getHttpService();
if (httpService != null) {
hostAndPort = getHostAndPortForRequest(httpService);
}
} catch (Exception e) {
report.setMessage(e.getMessage());
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
if (hostAndPort != null) {
part.setMessage(hostAndPort.getHost() + ":" +
hostAndPort.getPort());
part.addProperty("host", hostAndPort.getHost()); //property for REST Access
part.addProperty("port", ""+hostAndPort.getPort()); //property for REST Access
}
report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}