From 153ba1adfa79b86d0c03a821bba34e4dcac1f279 Mon Sep 17 00:00:00 2001 From: Andrew DeMaria Date: Sat, 7 Jan 2017 14:50:14 -0700 Subject: [PATCH] Cleanup playlists controller and fix 404 Signed-off-by: Andrew DeMaria --- .../player/controller/PlaylistsController.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/PlaylistsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/PlaylistsController.java index daa19cfb..9e3abe61 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/PlaylistsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/PlaylistsController.java @@ -27,8 +27,10 @@ import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; 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.ParameterizableViewController; import org.springframework.web.servlet.view.RedirectView; @@ -49,23 +51,24 @@ import org.libresonic.player.service.SettingsService; */ @Controller @RequestMapping("/playlists") -public class PlaylistsController extends ParameterizableViewController { +public class PlaylistsController { @Autowired private SecurityService securityService; + @Autowired private PlaylistService playlistService; - @Override - protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { + @RequestMapping(method = RequestMethod.GET) + public String doGet(HttpServletRequest request, Model model) throws Exception { Map map = new HashMap<>(); User user = securityService.getCurrentUser(request); List playlists = playlistService.getReadablePlaylistsForUser(user.getUsername()); map.put("playlists", playlists); - return new ModelAndView("playlists","model",map); + model.addAttribute("model", map); + return "playlists"; } - }