Controller migration

master
Rémi Cocula 8 years ago
parent 449f6a906a
commit 2bb026b968
  1. 14
      libresonic-main/src/main/java/org/libresonic/player/controller/AvatarController.java
  2. 4
      libresonic-main/src/main/resources/libresonic-servlet.xml

@ -22,9 +22,12 @@ package org.libresonic.player.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
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.mvc.Controller;
import org.springframework.web.servlet.mvc.LastModified;
import org.libresonic.player.domain.Avatar;
@ -37,8 +40,11 @@ import org.libresonic.player.service.SettingsService;
*
* @author Sindre Mehus
*/
public class AvatarController implements Controller, LastModified {
@Controller
@RequestMapping("/avatar")
public class AvatarController implements LastModified {
@Autowired
private SettingsService settingsService;
public long getLastModified(HttpServletRequest request) {
@ -54,6 +60,7 @@ public class AvatarController implements Controller, LastModified {
return result;
}
@RequestMapping(method = RequestMethod.GET)
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
Avatar avatar = getAvatar(request);
@ -87,7 +94,4 @@ public class AvatarController implements Controller, LastModified {
return settingsService.getSystemAvatar(userSettings.getSystemAvatarId());
}
public void setSettingsService(SettingsService settingsService) {
this.settingsService = settingsService;
}
}

@ -15,9 +15,6 @@
<mvc:annotation-driven />
<context:component-scan base-package="org.libresonic.player.controller, org.libresonic.player.validator"/>
<bean id="avatarController" class="org.libresonic.player.controller.AvatarController">
<property name="settingsService" ref="settingsService"/>
</bean>
<bean id="proxyController" class="org.libresonic.player.controller.ProxyController"/>
<bean id="statusChartController" class="org.libresonic.player.controller.StatusChartController">
<property name="statusService" ref="statusService"/>
@ -129,7 +126,6 @@
<prop key="/notFound.view">multiController</prop>
<prop key="/index.view">multiController</prop>
<prop key="/videoPlayer.view">videoPlayerController</prop>
<prop key="/avatar.view">avatarController</prop>
<prop key="/proxy.view">proxyController</prop>
<prop key="/statusChart.view">statusChartController</prop>
<prop key="/userChart.view">userChartController</prop>

Loading…
Cancel
Save