Controllers migration.

master
Rémi Cocula 8 years ago
parent 1ac243b49b
commit caac456171
  1. 38
      libresonic-main/src/main/java/org/libresonic/player/controller/PodcastChannelController.java
  2. 6
      libresonic-main/src/main/resources/libresonic-servlet.xml

@ -19,34 +19,39 @@
package org.libresonic.player.controller; package org.libresonic.player.controller;
import java.util.HashMap; import org.libresonic.player.service.PodcastService;
import java.util.Map; import org.libresonic.player.service.SecurityService;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.ParameterizableViewController;
import org.libresonic.player.service.PodcastService; import javax.servlet.http.HttpServletRequest;
import org.libresonic.player.service.SecurityService; import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
/** /**
* Controller for the "Podcast channel" page. * Controller for the "Podcast channel" page.
* *
* @author Sindre Mehus * @author Sindre Mehus
*/ */
public class PodcastChannelController extends ParameterizableViewController { @Controller
@RequestMapping("/podcastChannel")
public class PodcastChannelController {
@Autowired
private PodcastService podcastService; private PodcastService podcastService;
@Autowired
private SecurityService securityService; private SecurityService securityService;
@Override @RequestMapping(method = RequestMethod.GET)
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<>();
ModelAndView result = super.handleRequestInternal(request, response); ModelAndView result = new ModelAndView();
result.addObject("model", map); result.addObject("model", map);
int channelId = ServletRequestUtils.getRequiredIntParameter(request, "id"); int channelId = ServletRequestUtils.getRequiredIntParameter(request, "id");
@ -57,11 +62,4 @@ public class PodcastChannelController extends ParameterizableViewController {
return result; return result;
} }
public void setPodcastService(PodcastService podcastService) {
this.podcastService = podcastService;
}
public void setSecurityService(SecurityService securityService) {
this.securityService = securityService;
}
} }

@ -15,11 +15,6 @@
<mvc:annotation-driven /> <mvc:annotation-driven />
<context:component-scan base-package="org.libresonic.player.controller, org.libresonic.player.validator"/> <context:component-scan base-package="org.libresonic.player.controller, org.libresonic.player.validator"/>
<bean id="podcastChannelController" class="org.libresonic.player.controller.PodcastChannelController">
<property name="viewName" value="podcastChannel"/>
<property name="podcastService" ref="podcastService"/>
<property name="securityService" ref="securityService"/>
</bean>
<bean id="podcastReceiverAdminController" class="org.libresonic.player.controller.PodcastReceiverAdminController"> <bean id="podcastReceiverAdminController" class="org.libresonic.player.controller.PodcastReceiverAdminController">
<property name="podcastService" ref="podcastService"/> <property name="podcastService" ref="podcastService"/>
</bean> </bean>
@ -221,7 +216,6 @@
<prop key="/download.view">downloadController</prop> <prop key="/download.view">downloadController</prop>
<prop key="/db.view">dbController</prop> <prop key="/db.view">dbController</prop>
<prop key="/test.view">multiController</prop> <prop key="/test.view">multiController</prop>
<prop key="/podcastChannel.view">podcastChannelController</prop>
<prop key="/podcastReceiverAdmin.view">podcastReceiverAdminController</prop> <prop key="/podcastReceiverAdmin.view">podcastReceiverAdminController</prop>
<prop key="/podcast/**">podcastController</prop> <prop key="/podcast/**">podcastController</prop>
<prop key="/wap/download.view">downloadController</prop> <prop key="/wap/download.view">downloadController</prop>

Loading…
Cancel
Save