From 319652bacdb5a4d2f9fa817163d59918493f766a Mon Sep 17 00:00:00 2001 From: DOHA Date: Fri, 27 Mar 2015 20:28:46 +0200 Subject: [PATCH] fix response format --- .../java/org/baeldung/web/controller/RootController.java | 5 +++-- .../main/java/org/baeldung/web/metric/IMetricService.java | 6 ++++-- .../main/java/org/baeldung/web/metric/MetricService.java | 8 ++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/spring-security-rest-full/src/main/java/org/baeldung/web/controller/RootController.java b/spring-security-rest-full/src/main/java/org/baeldung/web/controller/RootController.java index 6e4fd738aa..fdef43de7d 100644 --- a/spring-security-rest-full/src/main/java/org/baeldung/web/controller/RootController.java +++ b/spring-security-rest-full/src/main/java/org/baeldung/web/controller/RootController.java @@ -1,6 +1,7 @@ package org.baeldung.web.controller; import java.net.URI; +import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -42,13 +43,13 @@ public class RootController { @RequestMapping(value = "/metric", method = RequestMethod.GET) @ResponseBody - public String getMetric() { + public Map getMetric() { return metricService.getFullMetric(); } @RequestMapping(value = "/status-metric", method = RequestMethod.GET) @ResponseBody - public String getStatusMetric() { + public Map getStatusMetric() { return metricService.getStatusMetric(); } diff --git a/spring-security-rest-full/src/main/java/org/baeldung/web/metric/IMetricService.java b/spring-security-rest-full/src/main/java/org/baeldung/web/metric/IMetricService.java index fe64366a45..902d6ac811 100644 --- a/spring-security-rest-full/src/main/java/org/baeldung/web/metric/IMetricService.java +++ b/spring-security-rest-full/src/main/java/org/baeldung/web/metric/IMetricService.java @@ -1,12 +1,14 @@ package org.baeldung.web.metric; +import java.util.Map; + public interface IMetricService { void increaseCount(final String request, final int status); - String getFullMetric(); + Map getFullMetric(); - String getStatusMetric(); + Map getStatusMetric(); Object[][] getGraphData(); } diff --git a/spring-security-rest-full/src/main/java/org/baeldung/web/metric/MetricService.java b/spring-security-rest-full/src/main/java/org/baeldung/web/metric/MetricService.java index ed33b70ba3..504e82e654 100644 --- a/spring-security-rest-full/src/main/java/org/baeldung/web/metric/MetricService.java +++ b/spring-security-rest-full/src/main/java/org/baeldung/web/metric/MetricService.java @@ -34,13 +34,13 @@ public class MetricService implements IMetricService { } @Override - public String getFullMetric() { - return metricMap.entrySet().toString(); + public Map getFullMetric() { + return metricMap; } @Override - public String getStatusMetric() { - return statusMetric.entrySet().toString(); + public Map getStatusMetric() { + return statusMetric; } @Override