Cleanup playlists controller and fix 404

Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>
master
Andrew DeMaria 8 years ago
parent 37b35cdb87
commit 153ba1adfa
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 13
      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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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.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.springframework.web.servlet.mvc.ParameterizableViewController;
import org.springframework.web.servlet.view.RedirectView; import org.springframework.web.servlet.view.RedirectView;
@ -49,23 +51,24 @@ import org.libresonic.player.service.SettingsService;
*/ */
@Controller @Controller
@RequestMapping("/playlists") @RequestMapping("/playlists")
public class PlaylistsController extends ParameterizableViewController { public class PlaylistsController {
@Autowired @Autowired
private SecurityService securityService; private SecurityService securityService;
@Autowired @Autowired
private PlaylistService playlistService; private PlaylistService playlistService;
@Override @RequestMapping(method = RequestMethod.GET)
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { public String doGet(HttpServletRequest request, Model model) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
User user = securityService.getCurrentUser(request); User user = securityService.getCurrentUser(request);
List<Playlist> playlists = playlistService.getReadablePlaylistsForUser(user.getUsername()); List<Playlist> playlists = playlistService.getReadablePlaylistsForUser(user.getUsername());
map.put("playlists", playlists); map.put("playlists", playlists);
return new ModelAndView("playlists","model",map); model.addAttribute("model", map);
return "playlists";
} }
} }

Loading…
Cancel
Save