Controller migration
This commit is contained in:
+1
-1
@@ -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.
|
||||
|
||||
+8
-3
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+8
-3
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,12 +15,6 @@
|
||||
<mvc:annotation-driven />
|
||||
<context:component-scan base-package="org.libresonic.player.controller, org.libresonic.player.validator"/>
|
||||
|
||||
<bean id="statusChartController" class="org.libresonic.player.controller.StatusChartController">
|
||||
<property name="statusService" ref="statusService"/>
|
||||
</bean>
|
||||
<bean id="userChartController" class="org.libresonic.player.controller.UserChartController">
|
||||
<property name="securityService" ref="securityService"/>
|
||||
</bean>
|
||||
<bean id="m3uController" class="org.libresonic.player.controller.M3UController">
|
||||
<property name="playerService" ref="playerService"/>
|
||||
<property name="settingsService" ref="settingsService"/>
|
||||
@@ -125,8 +119,6 @@
|
||||
<prop key="/notFound.view">multiController</prop>
|
||||
<prop key="/index.view">multiController</prop>
|
||||
<prop key="/videoPlayer.view">videoPlayerController</prop>
|
||||
<prop key="/statusChart.view">statusChartController</prop>
|
||||
<prop key="/userChart.view">userChartController</prop>
|
||||
<prop key="/download.view">downloadController</prop>
|
||||
<prop key="/db.view">dbController</prop>
|
||||
<prop key="/test.view">multiController</prop>
|
||||
|
||||
Reference in New Issue
Block a user