From f90de5e31007b837806865e221cbf59bc93e28a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Cocula?= Date: Sun, 18 Dec 2016 00:08:05 +0100 Subject: [PATCH] Controllers migration. --- .../SetMusicFileInfoController.java | 26 ++++++++++--------- .../src/main/resources/libresonic-servlet.xml | 4 --- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/SetMusicFileInfoController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/SetMusicFileInfoController.java index d7edb47d..5a54e271 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/SetMusicFileInfoController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/SetMusicFileInfoController.java @@ -19,28 +19,33 @@ */ package org.libresonic.player.controller; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import org.libresonic.player.domain.MediaFile; +import org.libresonic.player.service.MediaFileService; +import org.libresonic.player.util.StringUtil; +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.AbstractController; import org.springframework.web.servlet.view.RedirectView; -import org.libresonic.player.domain.MediaFile; -import org.libresonic.player.service.MediaFileService; -import org.libresonic.player.util.StringUtil; +import javax.servlet.http.HttpServletRequest; /** * Controller for updating music file metadata. * * @author Sindre Mehus */ -public class SetMusicFileInfoController extends AbstractController { +@Controller +@RequestMapping("/setMusicFileInfo") +public class SetMusicFileInfoController { + @Autowired private MediaFileService mediaFileService; - protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { + @RequestMapping(method = RequestMethod.GET) + protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { int id = ServletRequestUtils.getRequiredIntParameter(request, "id"); String action = request.getParameter("action"); @@ -55,7 +60,4 @@ public class SetMusicFileInfoController extends AbstractController { return new ModelAndView(new RedirectView(url)); } - public void setMediaFileService(MediaFileService mediaFileService) { - this.mediaFileService = mediaFileService; - } } diff --git a/libresonic-main/src/main/resources/libresonic-servlet.xml b/libresonic-main/src/main/resources/libresonic-servlet.xml index fc15cd5b..d8692963 100644 --- a/libresonic-main/src/main/resources/libresonic-servlet.xml +++ b/libresonic-main/src/main/resources/libresonic-servlet.xml @@ -15,9 +15,6 @@ - - - @@ -189,7 +186,6 @@ multiController - setMusicFileInfoController shareManagementController setRatingController changeCoverArtController