diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/AbstractChartController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/AbstractChartController.java index eb5f9eed..28fa58cc 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/AbstractChartController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/AbstractChartController.java @@ -32,7 +32,7 @@ import java.util.*; * * @author Sindre Mehus */ -public abstract class AbstractChartController implements Controller { +public abstract class AbstractChartController { /** * Returns the chart background color for the current theme. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/StatusChartController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/StatusChartController.java index bd0366dd..be555e63 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/StatusChartController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/StatusChartController.java @@ -27,6 +27,10 @@ import org.jfree.chart.plot.*; import org.jfree.chart.renderer.xy.*; import org.jfree.data.*; import org.jfree.data.time.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.*; import javax.servlet.http.*; @@ -39,13 +43,17 @@ import java.util.List; * * @author Sindre Mehus */ +@Controller +@RequestMapping("/statusChart") public class StatusChartController extends AbstractChartController { + @Autowired private StatusService statusService; public static final int IMAGE_WIDTH = 350; public static final int IMAGE_HEIGHT = 150; + @RequestMapping(method = RequestMethod.GET) public synchronized ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { String type = request.getParameter("type"); int index = Integer.parseInt(request.getParameter("index")); @@ -144,7 +152,4 @@ public class StatusChartController extends AbstractChartController { return null; } - public void setStatusService(StatusService statusService) { - this.statusService = statusService; - } } diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/UserChartController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/UserChartController.java index cdb00a7c..812ae823 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/UserChartController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/UserChartController.java @@ -39,6 +39,10 @@ import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.renderer.category.BarRenderer; import org.jfree.data.category.CategoryDataset; import org.jfree.data.category.DefaultCategoryDataset; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.libresonic.player.domain.User; @@ -49,14 +53,18 @@ import org.libresonic.player.service.SecurityService; * * @author Sindre Mehus */ +@Controller +@RequestMapping("/userChart") public class UserChartController extends AbstractChartController { + @Autowired private SecurityService securityService; public static final int IMAGE_WIDTH = 400; public static final int IMAGE_MIN_HEIGHT = 200; private static final long BYTES_PER_MB = 1024L * 1024L; + @RequestMapping(method = RequestMethod.GET) public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { String type = request.getParameter("type"); CategoryDataset dataset = createDataset(type); @@ -140,7 +148,4 @@ public class UserChartController extends AbstractChartController { return chart; } - public void setSecurityService(SecurityService securityService) { - this.securityService = securityService; - } } diff --git a/libresonic-main/src/main/resources/libresonic-servlet.xml b/libresonic-main/src/main/resources/libresonic-servlet.xml index aaacd4ca..e2cafc86 100644 --- a/libresonic-main/src/main/resources/libresonic-servlet.xml +++ b/libresonic-main/src/main/resources/libresonic-servlet.xml @@ -15,12 +15,6 @@ - - - - - - @@ -125,8 +119,6 @@ multiController multiController videoPlayerController - statusChartController - userChartController downloadController dbController multiController