diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/AccessDeniedController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/AccessDeniedController.java
new file mode 100644
index 00000000..f36fd526
--- /dev/null
+++ b/libresonic-main/src/main/java/org/libresonic/player/controller/AccessDeniedController.java
@@ -0,0 +1,28 @@
+package org.libresonic.player.controller;
+
+import org.libresonic.player.Logger;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Spring MVC Controller that serves the login page.
+ */
+@Controller
+@RequestMapping("/accessDenied")
+public class AccessDeniedController {
+
+
+ private static final Logger LOG = Logger.getLogger(AccessDeniedController.class);
+
+ @RequestMapping(method = {RequestMethod.GET})
+ public ModelAndView accessDenied(HttpServletRequest request, HttpServletResponse response) {
+ return new ModelAndView("accessDenied");
+ }
+
+
+}
diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/ExportPlayListController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/ExportPlayListController.java
new file mode 100644
index 00000000..b03a5afb
--- /dev/null
+++ b/libresonic-main/src/main/java/org/libresonic/player/controller/ExportPlayListController.java
@@ -0,0 +1,51 @@
+package org.libresonic.player.controller;
+
+import org.libresonic.player.Logger;
+import org.libresonic.player.domain.Playlist;
+import org.libresonic.player.service.PlaylistService;
+import org.libresonic.player.service.SecurityService;
+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 javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Spring MVC Controller that serves the login page.
+ */
+@Controller
+@RequestMapping("/exportPlaylist")
+public class ExportPlayListController {
+
+
+ private static final Logger LOG = Logger.getLogger(ExportPlayListController.class);
+
+ @Autowired
+ private PlaylistService playlistService;
+ @Autowired
+ private SecurityService securityService;
+
+ @RequestMapping(method = { RequestMethod.GET })
+ public ModelAndView exportPlaylist(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
+ Playlist playlist = playlistService.getPlaylist(id);
+ if (!playlistService.isReadAllowed(playlist, securityService.getCurrentUsername(request))) {
+ response.sendError(HttpServletResponse.SC_FORBIDDEN);
+ return null;
+
+ }
+ response.setContentType("application/x-download");
+ response.setHeader("Content-Disposition", "attachment; filename=\"" + StringUtil.fileSystemSafe(playlist.getName()) + ".m3u8\"");
+
+ playlistService.exportPlaylist(id, response.getOutputStream());
+ return null;
+ }
+
+
+}
diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/NotFoundController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/NotFoundController.java
new file mode 100644
index 00000000..fd1d13cd
--- /dev/null
+++ b/libresonic-main/src/main/java/org/libresonic/player/controller/NotFoundController.java
@@ -0,0 +1,28 @@
+package org.libresonic.player.controller;
+
+import org.libresonic.player.Logger;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Spring MVC Controller that serves the login page.
+ */
+@Controller
+@RequestMapping("/notFound")
+public class NotFoundController {
+
+
+ private static final Logger LOG = Logger.getLogger(NotFoundController.class);
+
+ @RequestMapping(method = {RequestMethod.GET})
+ public ModelAndView notFound(HttpServletRequest request, HttpServletResponse response) {
+ return new ModelAndView("notFound");
+ }
+
+
+}
diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/MultiController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/RecoverController.java
similarity index 65%
rename from libresonic-main/src/main/java/org/libresonic/player/controller/MultiController.java
rename to libresonic-main/src/main/java/org/libresonic/player/controller/RecoverController.java
index 896c9e13..26abeae7 100644
--- a/libresonic-main/src/main/java/org/libresonic/player/controller/MultiController.java
+++ b/libresonic-main/src/main/java/org/libresonic/player/controller/RecoverController.java
@@ -1,69 +1,48 @@
-/*
- This file is part of Libresonic.
-
- Libresonic is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Libresonic is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Libresonic. If not, see .
-
- Copyright 2016 (C) Libresonic Authors
- Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
- */
package org.libresonic.player.controller;
-import javax.mail.Message;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import net.tanesha.recaptcha.ReCaptcha;
import net.tanesha.recaptcha.ReCaptchaFactory;
import net.tanesha.recaptcha.ReCaptchaResponse;
-import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.StringUtils;
import org.libresonic.player.Logger;
-import org.libresonic.player.domain.Playlist;
import org.libresonic.player.domain.User;
-import org.libresonic.player.domain.UserSettings;
-import org.libresonic.player.service.PlaylistService;
import org.libresonic.player.service.SecurityService;
import org.libresonic.player.service.SettingsService;
-import org.libresonic.player.util.StringUtil;
-import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
-import org.springframework.web.bind.ServletRequestUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+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.multiaction.MultiActionController;
-import org.springframework.web.servlet.view.RedirectView;
+import javax.mail.Message;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
/**
- * Multi-controller used for simple pages.
- *
- * @author Sindre Mehus
+ * Spring MVC Controller that serves the login page.
*/
-public class MultiController extends MultiActionController {
+@Controller
+@RequestMapping("/recover")
+public class RecoverController {
- private static final Logger LOG = Logger.getLogger(MultiController.class);
- private SecurityService securityService;
+ private static final Logger LOG = Logger.getLogger(RecoverController.class);
+
+ @Autowired
private SettingsService settingsService;
- private PlaylistService playlistService;
+ @Autowired
+ private SecurityService securityService;
+ @RequestMapping(method = {RequestMethod.GET})
public ModelAndView recover(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map map = new HashMap();
@@ -107,9 +86,20 @@ public class MultiController extends MultiActionController {
return new ModelAndView("recover", "model", map);
}
+ private User getUserByUsernameOrEmail(String usernameOrEmail) {
+ if (usernameOrEmail != null) {
+ User user = securityService.getUserByName(usernameOrEmail);
+ if (user != null) {
+ return user;
+ }
+ return securityService.getUserByEmail(usernameOrEmail);
+ }
+ return null;
+ }
+
/*
- * e-mail user new password via configured Smtp server
- */
+ * e-mail user new password via configured Smtp server
+ */
private boolean emailPassword(String password, String username, String email) {
/* Default to protocol smtp when SmtpEncryption is set to "None" */
String prot = "smtp";
@@ -169,57 +159,4 @@ public class MultiController extends MultiActionController {
}
}
- private User getUserByUsernameOrEmail(String usernameOrEmail) {
- if (usernameOrEmail != null) {
- User user = securityService.getUserByName(usernameOrEmail);
- if (user != null) {
- return user;
- }
- return securityService.getUserByEmail(usernameOrEmail);
- }
- return null;
- }
-
- public ModelAndView accessDenied(HttpServletRequest request, HttpServletResponse response) {
- return new ModelAndView("accessDenied");
- }
-
- public ModelAndView notFound(HttpServletRequest request, HttpServletResponse response) {
- return new ModelAndView("notFound");
- }
-
-
-
- public ModelAndView exportPlaylist(HttpServletRequest request, HttpServletResponse response) throws Exception {
-
- int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
- Playlist playlist = playlistService.getPlaylist(id);
- if (!playlistService.isReadAllowed(playlist, securityService.getCurrentUsername(request))) {
- response.sendError(HttpServletResponse.SC_FORBIDDEN);
- return null;
-
- }
- response.setContentType("application/x-download");
- response.setHeader("Content-Disposition", "attachment; filename=\"" + StringUtil.fileSystemSafe(playlist.getName()) + ".m3u8\"");
-
- playlistService.exportPlaylist(id, response.getOutputStream());
- return null;
- }
-
-
- public ModelAndView test(HttpServletRequest request, HttpServletResponse response) {
- return new ModelAndView("test");
- }
-
- public void setSecurityService(SecurityService securityService) {
- this.securityService = securityService;
- }
-
- public void setSettingsService(SettingsService settingsService) {
- this.settingsService = settingsService;
- }
-
- public void setPlaylistService(PlaylistService playlistService) {
- this.playlistService = playlistService;
- }
}
diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/TestController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/TestController.java
new file mode 100644
index 00000000..85609368
--- /dev/null
+++ b/libresonic-main/src/main/java/org/libresonic/player/controller/TestController.java
@@ -0,0 +1,28 @@
+package org.libresonic.player.controller;
+
+import org.libresonic.player.Logger;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Spring MVC Controller that serves the login page.
+ */
+@Controller
+@RequestMapping("/test")
+public class TestController {
+
+
+ private static final Logger LOG = Logger.getLogger(TestController.class);
+
+ @RequestMapping(method = {RequestMethod.GET})
+ public ModelAndView test(HttpServletRequest request, HttpServletResponse response) {
+ return new ModelAndView("test");
+ }
+
+
+}
diff --git a/libresonic-main/src/main/resources/libresonic-servlet.xml b/libresonic-main/src/main/resources/libresonic-servlet.xml
index 6a9618fb..d3d25ccf 100644
--- a/libresonic-main/src/main/resources/libresonic-servlet.xml
+++ b/libresonic-main/src/main/resources/libresonic-servlet.xml
@@ -53,11 +53,6 @@
-
-
-
-
-
@@ -108,15 +103,9 @@
- multiController
- multiController
- multiController
- multiController
- multiController
videoPlayerController
downloadController
dbController
- multiController
podcastController
downloadController
wapController