Use modern Spring mapping annotations

Java is verbose enough, no need to make it worse.
This commit is contained in:
jvoisin
2019-06-06 18:52:11 +00:00
committed by GitHub
parent 3492fc0c05
commit 828c1b2674
60 changed files with 157 additions and 141 deletions
@@ -3,8 +3,8 @@ package org.airsonic.player.controller;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -19,7 +19,7 @@ public class AccessDeniedController {
private static final Logger LOG = LoggerFactory.getLogger(AccessDeniedController.class); private static final Logger LOG = LoggerFactory.getLogger(AccessDeniedController.class);
@RequestMapping(method = {RequestMethod.GET}) @GetMapping
public ModelAndView accessDenied(HttpServletRequest request, HttpServletResponse response) { public ModelAndView accessDenied(HttpServletRequest request, HttpServletResponse response) {
LOG.info("The IP {0} tried to access the forbidden url {1}.", request.getRemoteAddr(), request.getRequestURL()); LOG.info("The IP {0} tried to access the forbidden url {1}.", request.getRemoteAddr(), request.getRequestURL());
return new ModelAndView("accessDenied"); return new ModelAndView("accessDenied");
@@ -25,9 +25,10 @@ import org.apache.commons.lang.StringUtils;
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.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
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.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
/** /**
@@ -42,8 +43,7 @@ public class AdvancedSettingsController {
@Autowired @Autowired
private SettingsService settingsService; private SettingsService settingsService;
// TODO replace with @GetMapping in Spring 4 @GetMapping
@RequestMapping(method = RequestMethod.GET)
protected String formBackingObject(Model model) throws Exception { protected String formBackingObject(Model model) throws Exception {
AdvancedSettingsCommand command = new AdvancedSettingsCommand(); AdvancedSettingsCommand command = new AdvancedSettingsCommand();
command.setDownloadLimit(String.valueOf(settingsService.getDownloadBitrateLimit())); command.setDownloadLimit(String.valueOf(settingsService.getDownloadBitrateLimit()));
@@ -68,7 +68,7 @@ public class AdvancedSettingsController {
return "advancedSettings"; return "advancedSettings";
} }
@RequestMapping(method = RequestMethod.POST) @PostMapping
protected String doSubmitAction(@ModelAttribute AdvancedSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception { protected String doSubmitAction(@ModelAttribute AdvancedSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception {
redirectAttributes.addFlashAttribute("settings_reload", false); redirectAttributes.addFlashAttribute("settings_reload", false);
@@ -20,8 +20,8 @@
package org.airsonic.player.controller; package org.airsonic.player.controller;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -36,7 +36,7 @@ import javax.servlet.http.HttpServletResponse;
@RequestMapping("/allmusic") @RequestMapping("/allmusic")
public class AllmusicController { public class AllmusicController {
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
ModelAndView result = new ModelAndView(); ModelAndView result = new ModelAndView();
result.addObject("album", request.getParameter("album")); result.addObject("album", request.getParameter("album"));
@@ -26,8 +26,8 @@ import org.airsonic.player.service.SettingsService;
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.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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.mvc.LastModified; import org.springframework.web.servlet.mvc.LastModified;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -58,7 +58,7 @@ public class AvatarController implements LastModified {
return result; return result;
} }
@RequestMapping(method = RequestMethod.GET) @GetMapping
public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
Avatar avatar = getAvatar(request); Avatar avatar = getAvatar(request);
@@ -33,8 +33,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
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.web.bind.annotation.PostMapping;
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 javax.imageio.ImageIO; import javax.imageio.ImageIO;
@@ -66,7 +66,7 @@ public class AvatarUploadController {
@Autowired @Autowired
private SecurityService securityService; private SecurityService securityService;
@RequestMapping(method = RequestMethod.POST) @PostMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception {
String username = securityService.getCurrentUsername(request); String username = securityService.getCurrentUsername(request);
@@ -25,8 +25,8 @@ import org.apache.commons.lang.StringUtils;
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.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -47,7 +47,7 @@ public class ChangeCoverArtController {
@Autowired @Autowired
private MediaFileService mediaFileService; private MediaFileService mediaFileService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
int id = ServletRequestUtils.getRequiredIntParameter(request, "id"); int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
@@ -35,8 +35,8 @@ import org.slf4j.LoggerFactory;
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.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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.mvc.LastModified; import org.springframework.web.servlet.mvc.LastModified;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@@ -98,7 +98,7 @@ public class CoverArtController implements LastModified {
return coverArtRequest.lastModified(); return coverArtRequest.lastModified();
} }
@RequestMapping(method = RequestMethod.GET) @GetMapping
public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
CoverArtRequest coverArtRequest = createCoverArtRequest(request); CoverArtRequest coverArtRequest = createCoverArtRequest(request);
@@ -25,8 +25,9 @@ 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.ui.Model;
import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
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.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -49,7 +50,7 @@ public class DLNASettingsController {
@Autowired @Autowired
private SettingsService settingsService; private SettingsService settingsService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
public String handleGet(Model model) throws Exception { public String handleGet(Model model) throws Exception {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
@@ -62,7 +63,7 @@ public class DLNASettingsController {
return "dlnaSettings"; return "dlnaSettings";
} }
@RequestMapping(method = RequestMethod.POST) @PostMapping
public String handlePost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception { public String handlePost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception {
handleParameters(request); handleParameters(request);
redirectAttributes.addFlashAttribute("settings_toast", true); redirectAttributes.addFlashAttribute("settings_toast", true);
@@ -27,9 +27,10 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
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.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@Controller @Controller
@@ -39,7 +40,7 @@ public class DatabaseSettingsController {
@Autowired @Autowired
private SettingsService settingsService; private SettingsService settingsService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected String displayForm() throws Exception { protected String displayForm() throws Exception {
return "databaseSettings"; return "databaseSettings";
} }
@@ -58,7 +59,7 @@ public class DatabaseSettingsController {
model.addAttribute("command", command); model.addAttribute("command", command);
} }
@RequestMapping(method = RequestMethod.POST) @PostMapping
protected String onSubmit(@ModelAttribute("command") @Validated DatabaseSettingsCommand command, protected String onSubmit(@ModelAttribute("command") @Validated DatabaseSettingsCommand command,
BindingResult bindingResult, BindingResult bindingResult,
RedirectAttributes redirectAttributes) throws Exception { RedirectAttributes redirectAttributes) throws Exception {
@@ -33,8 +33,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestBindingException; import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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.mvc.LastModified; import org.springframework.web.servlet.mvc.LastModified;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -87,7 +87,7 @@ public class DownloadController implements LastModified {
} }
} }
@RequestMapping(method = RequestMethod.GET) @GetMapping
public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
User user = securityService.getCurrentUser(request); User user = securityService.getCurrentUser(request);
@@ -28,8 +28,8 @@ import org.apache.commons.io.FilenameUtils;
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.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -54,7 +54,7 @@ public class EditTagsController {
@Autowired @Autowired
private MediaFileService mediaFileService; private MediaFileService mediaFileService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
int id = ServletRequestUtils.getRequiredIntParameter(request, "id"); int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
@@ -7,8 +7,8 @@ import org.airsonic.player.util.StringUtil;
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.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -26,7 +26,7 @@ public class ExportPlayListController {
@Autowired @Autowired
private SecurityService securityService; private SecurityService securityService;
@RequestMapping(method = { RequestMethod.GET }) @GetMapping
public ModelAndView exportPlaylist(HttpServletRequest request, HttpServletResponse response) throws Exception { public ModelAndView exportPlaylist(HttpServletRequest request, HttpServletResponse response) throws Exception {
int id = ServletRequestUtils.getRequiredIntParameter(request, "id"); int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
@@ -30,8 +30,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
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.util.UriComponentsBuilder; import org.springframework.web.util.UriComponentsBuilder;
@@ -64,7 +64,7 @@ public class ExternalPlayerController {
@Autowired @Autowired
private JWTSecurityService jwtSecurityService; private JWTSecurityService jwtSecurityService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@@ -25,9 +25,10 @@ import org.airsonic.player.service.SettingsService;
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.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
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.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.util.Locale; import java.util.Locale;
@@ -44,7 +45,7 @@ public class GeneralSettingsController {
@Autowired @Autowired
private SettingsService settingsService; private SettingsService settingsService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected String displayForm() throws Exception { protected String displayForm() throws Exception {
return "generalSettings"; return "generalSettings";
} }
@@ -91,7 +92,7 @@ public class GeneralSettingsController {
model.addAttribute("command",command); model.addAttribute("command",command);
} }
@RequestMapping(method = RequestMethod.POST) @PostMapping
protected String doSubmitAction(@ModelAttribute("command") GeneralSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception { protected String doSubmitAction(@ModelAttribute("command") GeneralSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception {
int themeIndex = Integer.parseInt(command.getThemeIndex()); int themeIndex = Integer.parseInt(command.getThemeIndex());
@@ -22,8 +22,8 @@ package org.airsonic.player.controller;
import org.airsonic.player.service.SettingsService; import org.airsonic.player.service.SettingsService;
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.web.bind.annotation.GetMapping;
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.view.RedirectView; import org.springframework.web.servlet.view.RedirectView;
@@ -39,7 +39,7 @@ public class GettingStartedController {
@Autowired @Autowired
private SettingsService settingsService; private SettingsService settingsService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
public ModelAndView gettingStarted(HttpServletRequest request) { public ModelAndView gettingStarted(HttpServletRequest request) {
if (request.getParameter("hide") != null) { if (request.getParameter("hide") != null) {
@@ -31,8 +31,8 @@ import org.apache.commons.lang.StringUtils;
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.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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.util.UriComponentsBuilder; import org.springframework.web.util.UriComponentsBuilder;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -66,7 +66,7 @@ public class HLSController {
@Autowired @Autowired
private JWTSecurityService jwtSecurityService; private JWTSecurityService jwtSecurityService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Origin", "*");
@@ -27,8 +27,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
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.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -61,7 +61,7 @@ public class HelpController {
@Autowired @Autowired
private SecurityService securityService; private SecurityService securityService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@@ -23,8 +23,8 @@ import org.airsonic.player.domain.*;
import org.airsonic.player.service.*; import org.airsonic.player.service.*;
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.web.bind.annotation.GetMapping;
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.view.RedirectView; import org.springframework.web.servlet.view.RedirectView;
@@ -60,7 +60,7 @@ public class HomeController {
@Autowired @Autowired
private SearchService searchService; private SearchService searchService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception {
User user = securityService.getCurrentUser(request); User user = securityService.getCurrentUser(request);
@@ -30,8 +30,9 @@ import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
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.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
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.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -54,7 +55,7 @@ public class ImportPlaylistController {
@Autowired @Autowired
private PlaylistService playlistService; private PlaylistService playlistService;
@RequestMapping(method = RequestMethod.POST) @PostMapping
protected String handlePost(RedirectAttributes redirectAttributes, protected String handlePost(RedirectAttributes redirectAttributes,
HttpServletRequest request HttpServletRequest request
) throws Exception { ) throws Exception {
@@ -91,7 +92,7 @@ public class ImportPlaylistController {
return "redirect:importPlaylist"; return "redirect:importPlaylist";
} }
@RequestMapping(method = RequestMethod.GET) @GetMapping
public String handleGet() { public String handleGet() {
return "importPlaylist"; return "importPlaylist";
} }
@@ -5,8 +5,8 @@ import org.airsonic.player.service.SecurityService;
import org.airsonic.player.service.SettingsService; import org.airsonic.player.service.SettingsService;
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.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -23,7 +23,7 @@ public class IndexController {
@Autowired @Autowired
private SettingsService settingsService; private SettingsService settingsService;
@RequestMapping(method = { RequestMethod.GET}) @GetMapping
public ModelAndView index(HttpServletRequest request) { public ModelAndView index(HttpServletRequest request) {
UserSettings userSettings = settingsService.getUserSettings(securityService.getCurrentUsername(request)); UserSettings userSettings = settingsService.getUserSettings(securityService.getCurrentUsername(request));
@@ -25,8 +25,9 @@ import org.apache.commons.lang.StringUtils;
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.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
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.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -48,7 +49,7 @@ public class InternetRadioSettingsController {
@Autowired @Autowired
private SettingsService settingsService; private SettingsService settingsService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
public String doGet(Model model) throws Exception { public String doGet(Model model) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@@ -59,7 +60,7 @@ public class InternetRadioSettingsController {
return "internetRadioSettings"; return "internetRadioSettings";
} }
@RequestMapping(method = RequestMethod.POST) @PostMapping
public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception { public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception {
String error = handleParameters(request); String error = handleParameters(request);
@@ -26,8 +26,8 @@ import org.airsonic.player.util.StringUtil;
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.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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.support.RequestContextUtils; import org.springframework.web.servlet.support.RequestContextUtils;
@@ -111,7 +111,7 @@ public class LeftController {
return lastModified; return lastModified;
} }
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
boolean musicFolderChanged = saveSelectedMusicFolder(request); boolean musicFolderChanged = saveSelectedMusicFolder(request);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@@ -7,8 +7,8 @@ import org.airsonic.player.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
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.view.RedirectView; import org.springframework.web.servlet.view.RedirectView;
@@ -22,6 +22,7 @@ import java.util.Map;
* Spring MVC Controller that serves the login page. * Spring MVC Controller that serves the login page.
*/ */
@Controller @Controller
@RequestMapping("/login")
public class LoginController { public class LoginController {
@Autowired @Autowired
@@ -29,7 +30,7 @@ public class LoginController {
@Autowired @Autowired
private SettingsService settingsService; private SettingsService settingsService;
@RequestMapping(value = "/login", method = RequestMethod.GET) @GetMapping
public ModelAndView login(HttpServletRequest request, HttpServletResponse response) throws Exception { public ModelAndView login(HttpServletRequest request, HttpServletResponse response) throws Exception {
// Auto-login if "user" and "password" parameters are given. // Auto-login if "user" and "password" parameters are given.
@@ -20,8 +20,8 @@
package org.airsonic.player.controller; package org.airsonic.player.controller;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -39,7 +39,7 @@ import java.util.Map;
@RequestMapping("/lyrics") @RequestMapping("/lyrics")
public class LyricsController { public class LyricsController {
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@@ -29,8 +29,8 @@ import org.airsonic.player.service.TranscodingService;
import org.airsonic.player.util.StringUtil; import org.airsonic.player.util.StringUtil;
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.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -56,7 +56,7 @@ public class M3UController {
@Autowired @Autowired
private JWTSecurityService jwtSecurityService; private JWTSecurityService jwtSecurityService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setContentType("audio/x-mpegurl"); response.setContentType("audio/x-mpegurl");
response.setCharacterEncoding(StringUtil.ENCODING_UTF8); response.setCharacterEncoding(StringUtil.ENCODING_UTF8);
@@ -25,8 +25,8 @@ import org.apache.commons.lang3.BooleanUtils;
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.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView; import org.springframework.web.servlet.view.RedirectView;
@@ -58,7 +58,7 @@ public class MainController {
@Autowired @Autowired
private MediaFileService mediaFileService; private MediaFileService mediaFileService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(@RequestParam(name = "showAll", required = false) Boolean showAll, protected ModelAndView handleRequestInternal(@RequestParam(name = "showAll", required = false) Boolean showAll,
HttpServletRequest request, HttpServletRequest request,
HttpServletResponse response) throws Exception { HttpServletResponse response) throws Exception {
@@ -28,8 +28,8 @@ import org.airsonic.player.service.SecurityService;
import org.airsonic.player.service.SettingsService; import org.airsonic.player.service.SettingsService;
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.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -59,7 +59,7 @@ public class MoreController {
@Autowired @Autowired
private MediaFileService mediaFileService; private MediaFileService mediaFileService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@@ -31,9 +31,10 @@ import org.slf4j.LoggerFactory;
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.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
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.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@@ -63,7 +64,7 @@ public class MusicFolderSettingsController {
@Autowired @Autowired
private MediaFileDao mediaFileDao; private MediaFileDao mediaFileDao;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected String displayForm() throws Exception { protected String displayForm() throws Exception {
return "musicFolderSettings"; return "musicFolderSettings";
} }
@@ -112,7 +113,7 @@ public class MusicFolderSettingsController {
return musicFolders.stream().map(MusicFolderSettingsCommand.MusicFolderInfo::new).collect(Collectors.toCollection(ArrayList::new)); return musicFolders.stream().map(MusicFolderSettingsCommand.MusicFolderInfo::new).collect(Collectors.toCollection(ArrayList::new));
} }
@RequestMapping(method = RequestMethod.POST) @PostMapping
protected String onSubmit(@ModelAttribute("command") MusicFolderSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception { protected String onSubmit(@ModelAttribute("command") MusicFolderSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception {
for (MusicFolderSettingsCommand.MusicFolderInfo musicFolderInfo : command.getMusicFolders()) { for (MusicFolderSettingsCommand.MusicFolderInfo musicFolderInfo : command.getMusicFolders()) {
@@ -1,8 +1,8 @@
package org.airsonic.player.controller; package org.airsonic.player.controller;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -15,7 +15,7 @@ import javax.servlet.http.HttpServletResponse;
@RequestMapping("/notFound") @RequestMapping("/notFound")
public class NotFoundController { public class NotFoundController {
@RequestMapping(method = {RequestMethod.GET}) @GetMapping
public ModelAndView notFound(HttpServletRequest request, HttpServletResponse response) { public ModelAndView notFound(HttpServletRequest request, HttpServletResponse response) {
return new ModelAndView("notFound"); return new ModelAndView("notFound");
} }
@@ -27,8 +27,8 @@ import org.airsonic.player.service.PlayerService;
import org.airsonic.player.service.StatusService; import org.airsonic.player.service.StatusService;
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.web.bind.annotation.GetMapping;
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.view.RedirectView; import org.springframework.web.servlet.view.RedirectView;
@@ -53,7 +53,7 @@ public class NowPlayingController {
@Autowired @Autowired
private MediaFileService mediaFileService; private MediaFileService mediaFileService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Player player = playerService.getPlayer(request, response); Player player = playerService.getPlayer(request, response);
@@ -27,10 +27,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
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.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@@ -56,7 +57,7 @@ public class PasswordSettingsController {
} }
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView displayForm(HttpServletRequest request) throws Exception { protected ModelAndView displayForm(HttpServletRequest request) throws Exception {
PasswordSettingsCommand command = new PasswordSettingsCommand(); PasswordSettingsCommand command = new PasswordSettingsCommand();
User user = securityService.getCurrentUser(request); User user = securityService.getCurrentUser(request);
@@ -65,7 +66,7 @@ public class PasswordSettingsController {
return new ModelAndView("passwordSettings","command",command); return new ModelAndView("passwordSettings","command",command);
} }
@RequestMapping(method = RequestMethod.POST) @PostMapping
protected String doSubmitAction(@ModelAttribute("command") @Validated PasswordSettingsCommand command, BindingResult bindingResult, RedirectAttributes redirectAttributes) throws Exception { protected String doSubmitAction(@ModelAttribute("command") @Validated PasswordSettingsCommand command, BindingResult bindingResult, RedirectAttributes redirectAttributes) throws Exception {
if (!bindingResult.hasErrors()) { if (!bindingResult.hasErrors()) {
User user = securityService.getUserByName(command.getUsername()); User user = securityService.getUserByName(command.getUsername());
@@ -27,9 +27,10 @@ import org.apache.commons.lang.StringUtils;
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.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
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.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -108,12 +109,12 @@ public class PersonalSettingsController {
model.addAttribute("command",command); model.addAttribute("command",command);
} }
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected String displayForm() throws Exception { protected String displayForm() throws Exception {
return "personalSettings"; return "personalSettings";
} }
@RequestMapping(method = RequestMethod.POST) @PostMapping
protected String doSubmitAction(@ModelAttribute("command") PersonalSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception { protected String doSubmitAction(@ModelAttribute("command") PersonalSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception {
int localeIndex = Integer.parseInt(command.getLocaleIndex()); int localeIndex = Integer.parseInt(command.getLocaleIndex());
@@ -27,8 +27,8 @@ import org.airsonic.player.service.SecurityService;
import org.airsonic.player.service.SettingsService; import org.airsonic.player.service.SettingsService;
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.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -53,7 +53,7 @@ public class PlayQueueController {
@Autowired @Autowired
private SettingsService settingsService; private SettingsService settingsService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
User user = securityService.getCurrentUser(request); User user = securityService.getCurrentUser(request);
@@ -30,9 +30,10 @@ 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.ui.Model;
import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
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.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -57,7 +58,7 @@ public class PlayerSettingsController {
@Autowired @Autowired
private TranscodingService transcodingService; private TranscodingService transcodingService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected String displayForm() throws Exception { protected String displayForm() throws Exception {
return "playerSettings"; return "playerSettings";
} }
@@ -112,7 +113,7 @@ public class PlayerSettingsController {
model.addAttribute("command",command); model.addAttribute("command",command);
} }
@RequestMapping(method = RequestMethod.POST) @PostMapping
protected String doSubmitAction(@ModelAttribute("command") PlayerSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception { protected String doSubmitAction(@ModelAttribute("command") PlayerSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception {
Player player = playerService.getPlayerById(command.getPlayerId()); Player player = playerService.getPlayerById(command.getPlayerId());
if (player != null) { if (player != null) {
@@ -30,8 +30,8 @@ import org.airsonic.player.service.SettingsService;
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.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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.view.RedirectView; import org.springframework.web.servlet.view.RedirectView;
@@ -59,7 +59,7 @@ public class PlaylistController {
@Autowired @Autowired
private PlayerService playerService; private PlayerService playerService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@@ -25,8 +25,8 @@ import org.airsonic.player.service.SecurityService;
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.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -49,7 +49,7 @@ public class PlaylistsController {
@Autowired @Autowired
private PlaylistService playlistService; private PlaylistService playlistService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
public String doGet(HttpServletRequest request, Model model) throws Exception { public String doGet(HttpServletRequest request, Model model) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@@ -24,8 +24,8 @@ import org.airsonic.player.service.SecurityService;
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.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -48,7 +48,7 @@ public class PodcastChannelController {
@Autowired @Autowired
private SecurityService securityService; private SecurityService securityService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@@ -25,8 +25,8 @@ import org.airsonic.player.service.SecurityService;
import org.airsonic.player.service.SettingsService; import org.airsonic.player.service.SettingsService;
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.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -53,7 +53,7 @@ public class PodcastChannelsController {
@Autowired @Autowired
private SettingsService settingsService; private SettingsService settingsService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@@ -27,8 +27,8 @@ import org.airsonic.player.service.SettingsService;
import org.airsonic.player.util.StringUtil; import org.airsonic.player.util.StringUtil;
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.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -55,7 +55,7 @@ public class PodcastController {
@Autowired @Autowired
private SecurityService securityService; private SecurityService securityService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
String url = request.getRequestURL().toString(); String url = request.getRequestURL().toString();
@@ -25,9 +25,10 @@ import org.airsonic.player.service.SettingsService;
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.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
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.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
/** /**
@@ -44,7 +45,7 @@ public class PodcastSettingsController {
@Autowired @Autowired
private PodcastService podcastService; private PodcastService podcastService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected String formBackingObject(Model model) throws Exception { protected String formBackingObject(Model model) throws Exception {
PodcastSettingsCommand command = new PodcastSettingsCommand(); PodcastSettingsCommand command = new PodcastSettingsCommand();
@@ -57,7 +58,7 @@ public class PodcastSettingsController {
return "podcastSettings"; return "podcastSettings";
} }
@RequestMapping(method = RequestMethod.POST) @PostMapping
protected String doSubmitAction(@ModelAttribute PodcastSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception { protected String doSubmitAction(@ModelAttribute PodcastSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception {
settingsService.setPodcastUpdateInterval(Integer.parseInt(command.getInterval())); settingsService.setPodcastUpdateInterval(Integer.parseInt(command.getInterval()));
settingsService.setPodcastEpisodeRetentionCount(Integer.parseInt(command.getEpisodeRetentionCount())); settingsService.setPodcastEpisodeRetentionCount(Integer.parseInt(command.getEpisodeRetentionCount()));
@@ -27,8 +27,8 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -47,7 +47,7 @@ import static org.springframework.http.HttpStatus.*;
@RequestMapping("/proxy") @RequestMapping("/proxy")
public class ProxyController { public class ProxyController {
@RequestMapping(method = RequestMethod.GET) @GetMapping
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
String url = ServletRequestUtils.getRequiredStringParameter(request, "url"); String url = ServletRequestUtils.getRequiredStringParameter(request, "url");
@@ -30,8 +30,8 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.ServletRequestBindingException; import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.PostMapping;
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.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -57,7 +57,7 @@ public class RandomPlayQueueController {
@Autowired @Autowired
private SettingsService settingsService; private SettingsService settingsService;
@RequestMapping(method = RequestMethod.POST) @PostMapping
protected String handleRandomPlayQueue( protected String handleRandomPlayQueue(
ModelMap model, ModelMap model,
HttpServletRequest request, HttpServletRequest request,
@@ -25,8 +25,8 @@ import org.airsonic.player.service.SettingsService;
import org.airsonic.player.service.VersionService; import org.airsonic.player.service.VersionService;
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.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -50,7 +50,7 @@ public class RightController {
@Autowired @Autowired
private VersionService versionService; private VersionService versionService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
ModelAndView result = new ModelAndView("right"); ModelAndView result = new ModelAndView("right");
@@ -29,9 +29,10 @@ import org.apache.commons.lang.StringUtils;
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.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@@ -58,7 +59,7 @@ public class SearchController {
@Autowired @Autowired
private SearchService searchService; private SearchService searchService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected String displayForm() throws Exception { protected String displayForm() throws Exception {
return "search"; return "search";
} }
@@ -68,7 +69,7 @@ public class SearchController {
model.addAttribute("command",new SearchCommand()); model.addAttribute("command",new SearchCommand());
} }
@RequestMapping(method = RequestMethod.POST) @PostMapping
protected String onSubmit(HttpServletRequest request, HttpServletResponse response,@ModelAttribute("command") SearchCommand command, Model model) protected String onSubmit(HttpServletRequest request, HttpServletResponse response,@ModelAttribute("command") SearchCommand command, Model model)
throws Exception { throws Exception {
@@ -25,8 +25,8 @@ import org.airsonic.player.util.StringUtil;
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.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.PostMapping;
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.view.RedirectView; import org.springframework.web.servlet.view.RedirectView;
@@ -44,7 +44,7 @@ public class SetMusicFileInfoController {
@Autowired @Autowired
private MediaFileService mediaFileService; private MediaFileService mediaFileService;
@RequestMapping(method = RequestMethod.POST) @PostMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception {
int id = ServletRequestUtils.getRequiredIntParameter(request, "id"); int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
String action = request.getParameter("action"); String action = request.getParameter("action");
@@ -26,8 +26,8 @@ import org.airsonic.player.service.SecurityService;
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.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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.view.RedirectView; import org.springframework.web.servlet.view.RedirectView;
@@ -50,7 +50,7 @@ public class SetRatingController {
private MediaFileService mediaFileService; private MediaFileService mediaFileService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception {
int id = ServletRequestUtils.getRequiredIntParameter(request, "id"); int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
Integer rating = ServletRequestUtils.getIntParameter(request, "rating"); Integer rating = ServletRequestUtils.getIntParameter(request, "rating");
@@ -23,8 +23,8 @@ import org.airsonic.player.domain.User;
import org.airsonic.player.service.SecurityService; import org.airsonic.player.service.SecurityService;
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.web.bind.annotation.GetMapping;
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.view.RedirectView; import org.springframework.web.servlet.view.RedirectView;
@@ -42,7 +42,7 @@ public class SettingsController {
@Autowired @Autowired
private SecurityService securityService; private SecurityService securityService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception {
User user = securityService.getCurrentUser(request); User user = securityService.getCurrentUser(request);
@@ -28,8 +28,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestBindingException; import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -59,7 +59,7 @@ public class ShareManagementController {
@Autowired @Autowired
private SecurityService securityService; private SecurityService securityService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
public ModelAndView createShare(HttpServletRequest request, HttpServletResponse response) throws Exception { public ModelAndView createShare(HttpServletRequest request, HttpServletResponse response) throws Exception {
List<MediaFile> files = getMediaFiles(request); List<MediaFile> files = getMediaFiles(request);
@@ -32,8 +32,9 @@ 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.ui.Model;
import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
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.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -59,7 +60,7 @@ public class ShareSettingsController {
private SettingsService settingsService; private SettingsService settingsService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
public String doGet(HttpServletRequest request, Model model) throws Exception { public String doGet(HttpServletRequest request, Model model) throws Exception {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
@@ -70,7 +71,7 @@ public class ShareSettingsController {
return "shareSettings"; return "shareSettings";
} }
@RequestMapping(method = RequestMethod.POST) @PostMapping
public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception { public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception {
handleParameters(request); handleParameters(request);
@@ -26,8 +26,9 @@ 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.ui.Model;
import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
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.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -49,7 +50,7 @@ public class SonosSettingsController {
@Autowired @Autowired
private SonosService sonosService; private SonosService sonosService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
public String doGet(Model model) throws Exception { public String doGet(Model model) throws Exception {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
@@ -61,7 +62,7 @@ public class SonosSettingsController {
return "sonosSettings"; return "sonosSettings";
} }
@RequestMapping(method = RequestMethod.POST) @PostMapping
public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception { public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception {
handleParameters(request); handleParameters(request);
@@ -27,8 +27,8 @@ import org.airsonic.player.service.SecurityService;
import org.airsonic.player.service.SettingsService; import org.airsonic.player.service.SettingsService;
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.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -59,7 +59,7 @@ public class StarredController {
@Autowired @Autowired
private MediaFileService mediaFileService; private MediaFileService mediaFileService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@@ -33,8 +33,8 @@ import org.jfree.data.time.*;
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.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -60,7 +60,7 @@ public class StatusChartController extends AbstractChartController {
public static final int IMAGE_WIDTH = 350; public static final int IMAGE_WIDTH = 350;
public static final int IMAGE_HEIGHT = 150; public static final int IMAGE_HEIGHT = 150;
@RequestMapping(method = RequestMethod.GET) @GetMapping
public synchronized ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { public synchronized ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
String type = request.getParameter("type"); String type = request.getParameter("type");
int index = ServletRequestUtils.getIntParameter(request, "index", 0); int index = ServletRequestUtils.getIntParameter(request, "index", 0);
@@ -26,8 +26,8 @@ import org.airsonic.player.util.FileUtil;
import org.airsonic.player.util.StringUtil; import org.airsonic.player.util.StringUtil;
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.web.bind.annotation.GetMapping;
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.support.RequestContextUtils; import org.springframework.web.servlet.support.RequestContextUtils;
@@ -48,7 +48,7 @@ public class StatusController {
@Autowired @Autowired
private StatusService statusService; private StatusService statusService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@@ -38,8 +38,8 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestBindingException; import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -82,7 +82,7 @@ public class StreamController {
@Autowired @Autowired
private SearchService searchService; private SearchService searchService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
TransferStatus status = null; TransferStatus status = null;
@@ -26,8 +26,8 @@ import org.airsonic.player.service.SecurityService;
import org.airsonic.player.service.SettingsService; import org.airsonic.player.service.SettingsService;
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.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -49,7 +49,7 @@ public class TopController {
@Autowired @Autowired
private SecurityService securityService; private SecurityService securityService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@@ -26,8 +26,9 @@ import org.apache.commons.lang.StringUtils;
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.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
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.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -49,7 +50,7 @@ public class TranscodingSettingsController {
@Autowired @Autowired
private SettingsService settingsService; private SettingsService settingsService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
public String doGet(Model model) throws Exception { public String doGet(Model model) throws Exception {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
@@ -64,7 +65,7 @@ public class TranscodingSettingsController {
return "transcodingSettings"; return "transcodingSettings";
} }
@RequestMapping(method = RequestMethod.POST) @PostMapping
public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception { public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception {
String error = handleParameters(request, redirectAttributes); String error = handleParameters(request, redirectAttributes);
if(error != null) { if(error != null) {
@@ -35,8 +35,8 @@ import org.apache.commons.io.IOUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -71,7 +71,7 @@ public class UploadController {
private SettingsService settingsService; private SettingsService settingsService;
public static final String UPLOAD_STATUS = "uploadStatus"; public static final String UPLOAD_STATUS = "uploadStatus";
@RequestMapping(method = { RequestMethod.POST }) @PostMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@@ -35,8 +35,8 @@ import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.data.category.DefaultCategoryDataset;
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.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -61,7 +61,7 @@ public class UserChartController extends AbstractChartController {
public static final int IMAGE_MIN_HEIGHT = 200; public static final int IMAGE_MIN_HEIGHT = 200;
private static final long BYTES_PER_MB = 1024L * 1024L; private static final long BYTES_PER_MB = 1024L * 1024L;
@RequestMapping(method = RequestMethod.GET) @GetMapping
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
String type = request.getParameter("type"); String type = request.getParameter("type");
CategoryDataset dataset = createDataset(type); CategoryDataset dataset = createDataset(type);
@@ -38,10 +38,11 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.ServletRequestBindingException; import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
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.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -73,7 +74,7 @@ public class UserSettingsController {
binder.addValidators(userSettingsValidator); binder.addValidators(userSettingsValidator);
} }
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected String displayForm(HttpServletRequest request, Model model) throws Exception { protected String displayForm(HttpServletRequest request, Model model) throws Exception {
UserSettingsCommand command; UserSettingsCommand command;
if(!model.containsAttribute("command")) { if(!model.containsAttribute("command")) {
@@ -129,7 +130,7 @@ public class UserSettingsController {
return result; return result;
} }
@RequestMapping(method = RequestMethod.POST) @PostMapping
protected String doSubmitAction(@ModelAttribute("command") @Validated UserSettingsCommand command, BindingResult bindingResult, RedirectAttributes redirectAttributes) throws Exception { protected String doSubmitAction(@ModelAttribute("command") @Validated UserSettingsCommand command, BindingResult bindingResult, RedirectAttributes redirectAttributes) throws Exception {
if(!bindingResult.hasErrors()) { if(!bindingResult.hasErrors()) {
@@ -29,8 +29,8 @@ import org.airsonic.player.util.StringUtil;
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.web.bind.ServletRequestUtils; import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -59,7 +59,7 @@ public class VideoPlayerController {
@Autowired @Autowired
private SecurityService securityService; private SecurityService securityService;
@RequestMapping(method = RequestMethod.GET) @GetMapping
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
User user = securityService.getCurrentUser(request); User user = securityService.getCurrentUser(request);