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; package org.baeldung.web.controller;
import java.net.URI; import java.net.URI;
import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -42,13 +43,13 @@ public class RootController {
@RequestMapping(value = "/metric", method = RequestMethod.GET) @RequestMapping(value = "/metric", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public String getMetric() { public Map getMetric() {
return metricService.getFullMetric(); return metricService.getFullMetric();
} }
@RequestMapping(value = "/status-metric", method = RequestMethod.GET) @RequestMapping(value = "/status-metric", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public String getStatusMetric() { public Map getStatusMetric() {
return metricService.getStatusMetric(); return metricService.getStatusMetric();
} }

View File

@ -1,12 +1,14 @@
package org.baeldung.web.metric; package org.baeldung.web.metric;
import java.util.Map;
public interface IMetricService { public interface IMetricService {
void increaseCount(final String request, final int status); void increaseCount(final String request, final int status);
String getFullMetric(); Map getFullMetric();
String getStatusMetric(); Map getStatusMetric();
Object[][] getGraphData(); Object[][] getGraphData();
} }

View File

@ -34,13 +34,13 @@ public class MetricService implements IMetricService {
} }
@Override @Override
public String getFullMetric() { public Map getFullMetric() {
return metricMap.entrySet().toString(); return metricMap;
} }
@Override @Override
public String getStatusMetric() { public Map getStatusMetric() {
return statusMetric.entrySet().toString(); return statusMetric;
} }
@Override @Override