Merge pull request #177 from Doha2012/master

fix response format
This commit is contained in:
Eugen 2015-03-27 22:06:13 +02:00
commit 0e7f86b859
3 changed files with 11 additions and 8 deletions

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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