From 828c1b2674b1b5bf4f96454ed5c154a0c074f3bb Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 6 Jun 2019 18:52:11 +0000 Subject: [PATCH] Use modern Spring mapping annotations Java is verbose enough, no need to make it worse. --- .../player/controller/AccessDeniedController.java | 4 ++-- .../player/controller/AdvancedSettingsController.java | 8 ++++---- .../airsonic/player/controller/AllmusicController.java | 4 ++-- .../org/airsonic/player/controller/AvatarController.java | 6 +++--- .../player/controller/AvatarUploadController.java | 4 ++-- .../player/controller/ChangeCoverArtController.java | 4 ++-- .../airsonic/player/controller/CoverArtController.java | 4 ++-- .../player/controller/DLNASettingsController.java | 7 ++++--- .../player/controller/DatabaseSettingsController.java | 9 +++++---- .../airsonic/player/controller/DownloadController.java | 4 ++-- .../airsonic/player/controller/EditTagsController.java | 4 ++-- .../player/controller/ExportPlayListController.java | 4 ++-- .../player/controller/ExternalPlayerController.java | 4 ++-- .../player/controller/GeneralSettingsController.java | 7 ++++--- .../player/controller/GettingStartedController.java | 4 ++-- .../org/airsonic/player/controller/HLSController.java | 4 ++-- .../org/airsonic/player/controller/HelpController.java | 4 ++-- .../org/airsonic/player/controller/HomeController.java | 4 ++-- .../player/controller/ImportPlaylistController.java | 7 ++++--- .../org/airsonic/player/controller/IndexController.java | 4 ++-- .../controller/InternetRadioSettingsController.java | 7 ++++--- .../org/airsonic/player/controller/LeftController.java | 4 ++-- .../org/airsonic/player/controller/LoginController.java | 5 +++-- .../org/airsonic/player/controller/LyricsController.java | 4 ++-- .../org/airsonic/player/controller/M3UController.java | 4 ++-- .../org/airsonic/player/controller/MainController.java | 4 ++-- .../org/airsonic/player/controller/MoreController.java | 4 ++-- .../player/controller/MusicFolderSettingsController.java | 7 ++++--- .../airsonic/player/controller/NotFoundController.java | 4 ++-- .../airsonic/player/controller/NowPlayingController.java | 4 ++-- .../player/controller/PasswordSettingsController.java | 7 ++++--- .../player/controller/PersonalSettingsController.java | 7 ++++--- .../airsonic/player/controller/PlayQueueController.java | 4 ++-- .../player/controller/PlayerSettingsController.java | 7 ++++--- .../airsonic/player/controller/PlaylistController.java | 4 ++-- .../airsonic/player/controller/PlaylistsController.java | 4 ++-- .../player/controller/PodcastChannelController.java | 4 ++-- .../player/controller/PodcastChannelsController.java | 4 ++-- .../airsonic/player/controller/PodcastController.java | 6 +++--- .../player/controller/PodcastSettingsController.java | 7 ++++--- .../org/airsonic/player/controller/ProxyController.java | 6 +++--- .../player/controller/RandomPlayQueueController.java | 4 ++-- .../org/airsonic/player/controller/RightController.java | 4 ++-- .../org/airsonic/player/controller/SearchController.java | 7 ++++--- .../player/controller/SetMusicFileInfoController.java | 4 ++-- .../airsonic/player/controller/SetRatingController.java | 4 ++-- .../airsonic/player/controller/SettingsController.java | 4 ++-- .../player/controller/ShareManagementController.java | 4 ++-- .../player/controller/ShareSettingsController.java | 7 ++++--- .../player/controller/SonosSettingsController.java | 7 ++++--- .../airsonic/player/controller/StarredController.java | 4 ++-- .../player/controller/StatusChartController.java | 4 ++-- .../org/airsonic/player/controller/StatusController.java | 4 ++-- .../org/airsonic/player/controller/StreamController.java | 4 ++-- .../org/airsonic/player/controller/TopController.java | 4 ++-- .../player/controller/TranscodingSettingsController.java | 7 ++++--- .../org/airsonic/player/controller/UploadController.java | 4 ++-- .../airsonic/player/controller/UserChartController.java | 4 ++-- .../player/controller/UserSettingsController.java | 7 ++++--- .../player/controller/VideoPlayerController.java | 4 ++-- 60 files changed, 157 insertions(+), 141 deletions(-) diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/AccessDeniedController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/AccessDeniedController.java index c6156282..51ff8998 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/AccessDeniedController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/AccessDeniedController.java @@ -3,8 +3,8 @@ package org.airsonic.player.controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -19,7 +19,7 @@ public class AccessDeniedController { private static final Logger LOG = LoggerFactory.getLogger(AccessDeniedController.class); - @RequestMapping(method = {RequestMethod.GET}) + @GetMapping public ModelAndView accessDenied(HttpServletRequest request, HttpServletResponse response) { LOG.info("The IP {0} tried to access the forbidden url {1}.", request.getRemoteAddr(), request.getRequestURL()); return new ModelAndView("accessDenied"); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/AdvancedSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/AdvancedSettingsController.java index 96f9864f..d1a56b66 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/AdvancedSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/AdvancedSettingsController.java @@ -25,9 +25,10 @@ import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; /** @@ -42,8 +43,7 @@ public class AdvancedSettingsController { @Autowired private SettingsService settingsService; - // TODO replace with @GetMapping in Spring 4 - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected String formBackingObject(Model model) throws Exception { AdvancedSettingsCommand command = new AdvancedSettingsCommand(); command.setDownloadLimit(String.valueOf(settingsService.getDownloadBitrateLimit())); @@ -68,7 +68,7 @@ public class AdvancedSettingsController { return "advancedSettings"; } - @RequestMapping(method = RequestMethod.POST) + @PostMapping protected String doSubmitAction(@ModelAttribute AdvancedSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception { redirectAttributes.addFlashAttribute("settings_reload", false); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/AllmusicController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/AllmusicController.java index 3af2c772..d496580b 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/AllmusicController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/AllmusicController.java @@ -20,8 +20,8 @@ package org.airsonic.player.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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -36,7 +36,7 @@ import javax.servlet.http.HttpServletResponse; @RequestMapping("/allmusic") public class AllmusicController { - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView result = new ModelAndView(); result.addObject("album", request.getParameter("album")); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/AvatarController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/AvatarController.java index 72a1ce06..828e20e9 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/AvatarController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/AvatarController.java @@ -26,8 +26,8 @@ import org.airsonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.RequestMethod; import org.springframework.web.servlet.mvc.LastModified; import javax.servlet.http.HttpServletRequest; @@ -58,7 +58,7 @@ public class AvatarController implements LastModified { return result; } - @RequestMapping(method = RequestMethod.GET) + @GetMapping public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { Avatar avatar = getAvatar(request); @@ -94,4 +94,4 @@ public class AvatarController implements LastModified { return settingsService.getSystemAvatar(userSettings.getSystemAvatarId()); } -} \ No newline at end of file +} diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/AvatarUploadController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/AvatarUploadController.java index cdd42070..7d9eb69f 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/AvatarUploadController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/AvatarUploadController.java @@ -33,8 +33,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.imageio.ImageIO; @@ -66,7 +66,7 @@ public class AvatarUploadController { @Autowired private SecurityService securityService; - @RequestMapping(method = RequestMethod.POST) + @PostMapping protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { String username = securityService.getCurrentUsername(request); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/ChangeCoverArtController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/ChangeCoverArtController.java index 942d230b..b53b1d49 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/ChangeCoverArtController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/ChangeCoverArtController.java @@ -25,8 +25,8 @@ import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -47,7 +47,7 @@ public class ChangeCoverArtController { @Autowired private MediaFileService mediaFileService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { int id = ServletRequestUtils.getRequiredIntParameter(request, "id"); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/CoverArtController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/CoverArtController.java index 5f4691fd..1009b32a 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/CoverArtController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/CoverArtController.java @@ -35,8 +35,8 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.RequestMethod; import org.springframework.web.servlet.mvc.LastModified; import javax.annotation.PostConstruct; @@ -98,7 +98,7 @@ public class CoverArtController implements LastModified { return coverArtRequest.lastModified(); } - @RequestMapping(method = RequestMethod.GET) + @GetMapping public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { CoverArtRequest coverArtRequest = createCoverArtRequest(request); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/DLNASettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/DLNASettingsController.java index b3d791c0..dc764220 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/DLNASettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/DLNASettingsController.java @@ -25,8 +25,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.ServletRequestUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; @@ -49,7 +50,7 @@ public class DLNASettingsController { @Autowired private SettingsService settingsService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping public String handleGet(Model model) throws Exception { Map map = new HashMap(); @@ -62,7 +63,7 @@ public class DLNASettingsController { return "dlnaSettings"; } - @RequestMapping(method = RequestMethod.POST) + @PostMapping public String handlePost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception { handleParameters(request); redirectAttributes.addFlashAttribute("settings_toast", true); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/DatabaseSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/DatabaseSettingsController.java index 645c4d1d..cd01c9b2 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/DatabaseSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/DatabaseSettingsController.java @@ -27,9 +27,10 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; 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.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; @Controller @@ -39,7 +40,7 @@ public class DatabaseSettingsController { @Autowired private SettingsService settingsService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected String displayForm() throws Exception { return "databaseSettings"; } @@ -58,7 +59,7 @@ public class DatabaseSettingsController { model.addAttribute("command", command); } - @RequestMapping(method = RequestMethod.POST) + @PostMapping protected String onSubmit(@ModelAttribute("command") @Validated DatabaseSettingsCommand command, BindingResult bindingResult, RedirectAttributes redirectAttributes) throws Exception { @@ -91,4 +92,4 @@ public class DatabaseSettingsController { } } -} \ No newline at end of file +} diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/DownloadController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/DownloadController.java index ef949ca6..e3c15734 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/DownloadController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/DownloadController.java @@ -33,8 +33,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.ServletRequestBindingException; 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.RequestMethod; import org.springframework.web.servlet.mvc.LastModified; 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 { User user = securityService.getCurrentUser(request); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/EditTagsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/EditTagsController.java index fbd2aef2..37cc8b96 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/EditTagsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/EditTagsController.java @@ -28,8 +28,8 @@ import org.apache.commons.io.FilenameUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -54,7 +54,7 @@ public class EditTagsController { @Autowired private MediaFileService mediaFileService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { int id = ServletRequestUtils.getRequiredIntParameter(request, "id"); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/ExportPlayListController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/ExportPlayListController.java index 78f79ef7..d6c30b70 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/ExportPlayListController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/ExportPlayListController.java @@ -7,8 +7,8 @@ import org.airsonic.player.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.ServletRequestUtils; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -26,7 +26,7 @@ public class ExportPlayListController { @Autowired private SecurityService securityService; - @RequestMapping(method = { RequestMethod.GET }) + @GetMapping public ModelAndView exportPlaylist(HttpServletRequest request, HttpServletResponse response) throws Exception { int id = ServletRequestUtils.getRequiredIntParameter(request, "id"); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/ExternalPlayerController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/ExternalPlayerController.java index f2dd1a1f..9849d8e9 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/ExternalPlayerController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/ExternalPlayerController.java @@ -30,8 +30,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.util.UriComponentsBuilder; @@ -64,7 +64,7 @@ public class ExternalPlayerController { @Autowired private JWTSecurityService jwtSecurityService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { Map map = new HashMap<>(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/GeneralSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/GeneralSettingsController.java index a324d004..5ce194c4 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/GeneralSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/GeneralSettingsController.java @@ -25,9 +25,10 @@ import org.airsonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import java.util.Locale; @@ -44,7 +45,7 @@ public class GeneralSettingsController { @Autowired private SettingsService settingsService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected String displayForm() throws Exception { return "generalSettings"; } @@ -91,7 +92,7 @@ public class GeneralSettingsController { model.addAttribute("command",command); } - @RequestMapping(method = RequestMethod.POST) + @PostMapping protected String doSubmitAction(@ModelAttribute("command") GeneralSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception { int themeIndex = Integer.parseInt(command.getThemeIndex()); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/GettingStartedController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/GettingStartedController.java index aa50867f..56c6dbc3 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/GettingStartedController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/GettingStartedController.java @@ -22,8 +22,8 @@ package org.airsonic.player.controller; import org.airsonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; @@ -39,7 +39,7 @@ public class GettingStartedController { @Autowired private SettingsService settingsService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping public ModelAndView gettingStarted(HttpServletRequest request) { if (request.getParameter("hide") != null) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/HLSController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/HLSController.java index 02966123..5fee4bb7 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/HLSController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/HLSController.java @@ -31,8 +31,8 @@ import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.RequestMethod; import org.springframework.web.util.UriComponentsBuilder; import javax.servlet.http.HttpServletRequest; @@ -66,7 +66,7 @@ public class HLSController { @Autowired private JWTSecurityService jwtSecurityService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { response.setHeader("Access-Control-Allow-Origin", "*"); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/HelpController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/HelpController.java index b747bf10..0d09ef95 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/HelpController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/HelpController.java @@ -27,8 +27,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -61,7 +61,7 @@ public class HelpController { @Autowired private SecurityService securityService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { Map map = new HashMap<>(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/HomeController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/HomeController.java index 6423791b..c324f253 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/HomeController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/HomeController.java @@ -23,8 +23,8 @@ import org.airsonic.player.domain.*; import org.airsonic.player.service.*; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; @@ -60,7 +60,7 @@ public class HomeController { @Autowired private SearchService searchService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { User user = securityService.getCurrentUser(request); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/ImportPlaylistController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/ImportPlaylistController.java index 3b75a3a5..40cf78eb 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/ImportPlaylistController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/ImportPlaylistController.java @@ -30,8 +30,9 @@ import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; @@ -54,7 +55,7 @@ public class ImportPlaylistController { @Autowired private PlaylistService playlistService; - @RequestMapping(method = RequestMethod.POST) + @PostMapping protected String handlePost(RedirectAttributes redirectAttributes, HttpServletRequest request ) throws Exception { @@ -91,7 +92,7 @@ public class ImportPlaylistController { return "redirect:importPlaylist"; } - @RequestMapping(method = RequestMethod.GET) + @GetMapping public String handleGet() { return "importPlaylist"; } diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/IndexController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/IndexController.java index b384e966..ef178b51 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/IndexController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/IndexController.java @@ -5,8 +5,8 @@ import org.airsonic.player.service.SecurityService; import org.airsonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -23,7 +23,7 @@ public class IndexController { @Autowired private SettingsService settingsService; - @RequestMapping(method = { RequestMethod.GET}) + @GetMapping public ModelAndView index(HttpServletRequest request) { UserSettings userSettings = settingsService.getUserSettings(securityService.getCurrentUsername(request)); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/InternetRadioSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/InternetRadioSettingsController.java index 87585875..463ebb67 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/InternetRadioSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/InternetRadioSettingsController.java @@ -25,8 +25,9 @@ import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; @@ -48,7 +49,7 @@ public class InternetRadioSettingsController { @Autowired private SettingsService settingsService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping public String doGet(Model model) throws Exception { Map map = new HashMap<>(); @@ -59,7 +60,7 @@ public class InternetRadioSettingsController { return "internetRadioSettings"; } - @RequestMapping(method = RequestMethod.POST) + @PostMapping public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception { String error = handleParameters(request); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/LeftController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/LeftController.java index d38ddf19..79c67ee7 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/LeftController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/LeftController.java @@ -26,8 +26,8 @@ import org.airsonic.player.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.ServletRequestUtils; +import org.springframework.web.bind.annotation.GetMapping; 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.support.RequestContextUtils; @@ -111,7 +111,7 @@ public class LeftController { return lastModified; } - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { boolean musicFolderChanged = saveSelectedMusicFolder(request); Map map = new HashMap<>(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/LoginController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/LoginController.java index d9029cf1..a7ec9dfe 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/LoginController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/LoginController.java @@ -7,8 +7,8 @@ import org.airsonic.player.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; @@ -22,6 +22,7 @@ import java.util.Map; * Spring MVC Controller that serves the login page. */ @Controller +@RequestMapping("/login") public class LoginController { @Autowired @@ -29,7 +30,7 @@ public class LoginController { @Autowired private SettingsService settingsService; - @RequestMapping(value = "/login", method = RequestMethod.GET) + @GetMapping public ModelAndView login(HttpServletRequest request, HttpServletResponse response) throws Exception { // Auto-login if "user" and "password" parameters are given. diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/LyricsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/LyricsController.java index 7e376cec..99153217 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/LyricsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/LyricsController.java @@ -20,8 +20,8 @@ package org.airsonic.player.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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -39,7 +39,7 @@ import java.util.Map; @RequestMapping("/lyrics") public class LyricsController { - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { Map map = new HashMap<>(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/M3UController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/M3UController.java index daf4a042..0da153c3 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/M3UController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/M3UController.java @@ -29,8 +29,8 @@ import org.airsonic.player.service.TranscodingService; import org.airsonic.player.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -56,7 +56,7 @@ public class M3UController { @Autowired private JWTSecurityService jwtSecurityService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { response.setContentType("audio/x-mpegurl"); response.setCharacterEncoding(StringUtil.ENCODING_UTF8); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/MainController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/MainController.java index 2c91de3a..e629d64c 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/MainController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/MainController.java @@ -25,8 +25,8 @@ import org.apache.commons.lang3.BooleanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; @@ -58,7 +58,7 @@ public class MainController { @Autowired private MediaFileService mediaFileService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(@RequestParam(name = "showAll", required = false) Boolean showAll, HttpServletRequest request, HttpServletResponse response) throws Exception { diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/MoreController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/MoreController.java index 7df22501..7c30fd9c 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/MoreController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/MoreController.java @@ -28,8 +28,8 @@ import org.airsonic.player.service.SecurityService; import org.airsonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -59,7 +59,7 @@ public class MoreController { @Autowired private MediaFileService mediaFileService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { Map map = new HashMap<>(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/MusicFolderSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/MusicFolderSettingsController.java index 24dd6274..2dade807 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/MusicFolderSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/MusicFolderSettingsController.java @@ -31,9 +31,10 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.PostMapping; 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.servlet.mvc.support.RedirectAttributes; @@ -63,7 +64,7 @@ public class MusicFolderSettingsController { @Autowired private MediaFileDao mediaFileDao; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected String displayForm() throws Exception { return "musicFolderSettings"; } @@ -112,7 +113,7 @@ public class MusicFolderSettingsController { 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 { for (MusicFolderSettingsCommand.MusicFolderInfo musicFolderInfo : command.getMusicFolders()) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/NotFoundController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/NotFoundController.java index 784f0471..15fa576c 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/NotFoundController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/NotFoundController.java @@ -1,8 +1,8 @@ package org.airsonic.player.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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -15,7 +15,7 @@ import javax.servlet.http.HttpServletResponse; @RequestMapping("/notFound") public class NotFoundController { - @RequestMapping(method = {RequestMethod.GET}) + @GetMapping public ModelAndView notFound(HttpServletRequest request, HttpServletResponse response) { return new ModelAndView("notFound"); } diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/NowPlayingController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/NowPlayingController.java index 9b8258c1..47802f86 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/NowPlayingController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/NowPlayingController.java @@ -27,8 +27,8 @@ import org.airsonic.player.service.PlayerService; import org.airsonic.player.service.StatusService; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; @@ -53,7 +53,7 @@ public class NowPlayingController { @Autowired private MediaFileService mediaFileService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { Player player = playerService.getPlayer(request, response); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PasswordSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PasswordSettingsController.java index b4331587..c8ac0175 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PasswordSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PasswordSettingsController.java @@ -27,10 +27,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; 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.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.support.RedirectAttributes; @@ -56,7 +57,7 @@ public class PasswordSettingsController { } - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView displayForm(HttpServletRequest request) throws Exception { PasswordSettingsCommand command = new PasswordSettingsCommand(); User user = securityService.getCurrentUser(request); @@ -65,7 +66,7 @@ public class PasswordSettingsController { 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 { if (!bindingResult.hasErrors()) { User user = securityService.getUserByName(command.getUsername()); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PersonalSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PersonalSettingsController.java index 44899d36..b5167e67 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PersonalSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PersonalSettingsController.java @@ -27,9 +27,10 @@ import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; @@ -108,12 +109,12 @@ public class PersonalSettingsController { model.addAttribute("command",command); } - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected String displayForm() throws Exception { return "personalSettings"; } - @RequestMapping(method = RequestMethod.POST) + @PostMapping protected String doSubmitAction(@ModelAttribute("command") PersonalSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception { int localeIndex = Integer.parseInt(command.getLocaleIndex()); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PlayQueueController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PlayQueueController.java index a00d0df9..d0a04b43 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PlayQueueController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PlayQueueController.java @@ -27,8 +27,8 @@ import org.airsonic.player.service.SecurityService; import org.airsonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -53,7 +53,7 @@ public class PlayQueueController { @Autowired private SettingsService settingsService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { User user = securityService.getCurrentUser(request); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PlayerSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PlayerSettingsController.java index eb35ce2f..a19456f0 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PlayerSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PlayerSettingsController.java @@ -30,9 +30,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.ServletRequestUtils; +import org.springframework.web.bind.annotation.GetMapping; 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.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; @@ -57,7 +58,7 @@ public class PlayerSettingsController { @Autowired private TranscodingService transcodingService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected String displayForm() throws Exception { return "playerSettings"; } @@ -112,7 +113,7 @@ public class PlayerSettingsController { model.addAttribute("command",command); } - @RequestMapping(method = RequestMethod.POST) + @PostMapping protected String doSubmitAction(@ModelAttribute("command") PlayerSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception { Player player = playerService.getPlayerById(command.getPlayerId()); if (player != null) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PlaylistController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PlaylistController.java index f7538386..b16db033 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PlaylistController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PlaylistController.java @@ -30,8 +30,8 @@ import org.airsonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; @@ -59,7 +59,7 @@ public class PlaylistController { @Autowired private PlayerService playerService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { Map map = new HashMap<>(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PlaylistsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PlaylistsController.java index 8b9eed63..b84e94c5 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PlaylistsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PlaylistsController.java @@ -25,8 +25,8 @@ import org.airsonic.player.service.SecurityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.RequestMethod; import javax.servlet.http.HttpServletRequest; @@ -49,7 +49,7 @@ public class PlaylistsController { @Autowired private PlaylistService playlistService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping public String doGet(HttpServletRequest request, Model model) throws Exception { Map map = new HashMap<>(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastChannelController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastChannelController.java index 2b7c53fc..84e6de5a 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastChannelController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastChannelController.java @@ -24,8 +24,8 @@ import org.airsonic.player.service.SecurityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -48,7 +48,7 @@ public class PodcastChannelController { @Autowired private SecurityService securityService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { Map map = new HashMap<>(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastChannelsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastChannelsController.java index 42946cb1..8411496f 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastChannelsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastChannelsController.java @@ -25,8 +25,8 @@ import org.airsonic.player.service.SecurityService; import org.airsonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -53,7 +53,7 @@ public class PodcastChannelsController { @Autowired private SettingsService settingsService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { Map map = new HashMap<>(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastController.java index b3a1dc0b..677aad89 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastController.java @@ -27,8 +27,8 @@ import org.airsonic.player.service.SettingsService; import org.airsonic.player.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -55,7 +55,7 @@ public class PodcastController { @Autowired private SecurityService securityService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { String url = request.getRequestURL().toString(); @@ -133,4 +133,4 @@ public class PodcastController { return type; } } -} \ No newline at end of file +} diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastSettingsController.java index 4006384a..f4cd43be 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/PodcastSettingsController.java @@ -25,9 +25,10 @@ import org.airsonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; /** @@ -44,7 +45,7 @@ public class PodcastSettingsController { @Autowired private PodcastService podcastService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected String formBackingObject(Model model) throws Exception { PodcastSettingsCommand command = new PodcastSettingsCommand(); @@ -57,7 +58,7 @@ public class PodcastSettingsController { return "podcastSettings"; } - @RequestMapping(method = RequestMethod.POST) + @PostMapping protected String doSubmitAction(@ModelAttribute PodcastSettingsCommand command, RedirectAttributes redirectAttributes) throws Exception { settingsService.setPodcastUpdateInterval(Integer.parseInt(command.getInterval())); settingsService.setPodcastEpisodeRetentionCount(Integer.parseInt(command.getEpisodeRetentionCount())); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/ProxyController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/ProxyController.java index ae3bce10..666aa7e8 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/ProxyController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/ProxyController.java @@ -27,8 +27,8 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.springframework.stereotype.Controller; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -47,7 +47,7 @@ import static org.springframework.http.HttpStatus.*; @RequestMapping("/proxy") public class ProxyController { - @RequestMapping(method = RequestMethod.GET) + @GetMapping public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { String url = ServletRequestUtils.getRequiredStringParameter(request, "url"); @@ -74,4 +74,4 @@ public class ProxyController { } return null; } -} \ No newline at end of file +} diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/RandomPlayQueueController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/RandomPlayQueueController.java index b94f9685..66b9ca09 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/RandomPlayQueueController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/RandomPlayQueueController.java @@ -30,8 +30,8 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.ServletRequestBindingException; 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.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import javax.servlet.http.HttpServletRequest; @@ -57,7 +57,7 @@ public class RandomPlayQueueController { @Autowired private SettingsService settingsService; - @RequestMapping(method = RequestMethod.POST) + @PostMapping protected String handleRandomPlayQueue( ModelMap model, HttpServletRequest request, diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/RightController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/RightController.java index a5ece7eb..b198bc8c 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/RightController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/RightController.java @@ -25,8 +25,8 @@ import org.airsonic.player.service.SettingsService; import org.airsonic.player.service.VersionService; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -50,7 +50,7 @@ public class RightController { @Autowired private VersionService versionService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { Map map = new HashMap<>(); ModelAndView result = new ModelAndView("right"); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/SearchController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/SearchController.java index 091f6cbc..fd60b784 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/SearchController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/SearchController.java @@ -29,9 +29,10 @@ import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -58,7 +59,7 @@ public class SearchController { @Autowired private SearchService searchService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected String displayForm() throws Exception { return "search"; } @@ -68,7 +69,7 @@ public class SearchController { model.addAttribute("command",new SearchCommand()); } - @RequestMapping(method = RequestMethod.POST) + @PostMapping protected String onSubmit(HttpServletRequest request, HttpServletResponse response,@ModelAttribute("command") SearchCommand command, Model model) throws Exception { diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/SetMusicFileInfoController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/SetMusicFileInfoController.java index e40c635d..92018ecd 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/SetMusicFileInfoController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/SetMusicFileInfoController.java @@ -25,8 +25,8 @@ import org.airsonic.player.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.ServletRequestUtils; +import org.springframework.web.bind.annotation.PostMapping; 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.view.RedirectView; @@ -44,7 +44,7 @@ public class SetMusicFileInfoController { @Autowired private MediaFileService mediaFileService; - @RequestMapping(method = RequestMethod.POST) + @PostMapping protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { int id = ServletRequestUtils.getRequiredIntParameter(request, "id"); String action = request.getParameter("action"); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/SetRatingController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/SetRatingController.java index 80e0a0e2..5ab27123 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/SetRatingController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/SetRatingController.java @@ -26,8 +26,8 @@ import org.airsonic.player.service.SecurityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; @@ -50,7 +50,7 @@ public class SetRatingController { private MediaFileService mediaFileService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { int id = ServletRequestUtils.getRequiredIntParameter(request, "id"); Integer rating = ServletRequestUtils.getIntParameter(request, "rating"); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/SettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/SettingsController.java index f6b94efc..a1e13ead 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/SettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/SettingsController.java @@ -23,8 +23,8 @@ import org.airsonic.player.domain.User; import org.airsonic.player.service.SecurityService; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; @@ -42,7 +42,7 @@ public class SettingsController { @Autowired private SecurityService securityService; -@RequestMapping(method = RequestMethod.GET) +@GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { User user = securityService.getCurrentUser(request); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/ShareManagementController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/ShareManagementController.java index 8295f6c3..a37dd4eb 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/ShareManagementController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/ShareManagementController.java @@ -28,8 +28,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.ServletRequestBindingException; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -59,7 +59,7 @@ public class ShareManagementController { @Autowired private SecurityService securityService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping public ModelAndView createShare(HttpServletRequest request, HttpServletResponse response) throws Exception { List files = getMediaFiles(request); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/ShareSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/ShareSettingsController.java index 80be98e3..f1dd43e5 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/ShareSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/ShareSettingsController.java @@ -32,8 +32,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.ServletRequestUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; @@ -59,7 +60,7 @@ public class ShareSettingsController { private SettingsService settingsService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping public String doGet(HttpServletRequest request, Model model) throws Exception { Map map = new HashMap(); @@ -70,7 +71,7 @@ public class ShareSettingsController { return "shareSettings"; } - @RequestMapping(method = RequestMethod.POST) + @PostMapping public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception { handleParameters(request); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/SonosSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/SonosSettingsController.java index bb0c78dd..9cfaf424 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/SonosSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/SonosSettingsController.java @@ -26,8 +26,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.ServletRequestUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; @@ -49,7 +50,7 @@ public class SonosSettingsController { @Autowired private SonosService sonosService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping public String doGet(Model model) throws Exception { Map map = new HashMap(); @@ -61,7 +62,7 @@ public class SonosSettingsController { return "sonosSettings"; } - @RequestMapping(method = RequestMethod.POST) + @PostMapping public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception { handleParameters(request); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/StarredController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/StarredController.java index 9dc420f2..1f34dcf9 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/StarredController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/StarredController.java @@ -27,8 +27,8 @@ import org.airsonic.player.service.SecurityService; import org.airsonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -59,7 +59,7 @@ public class StarredController { @Autowired private MediaFileService mediaFileService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { Map map = new HashMap<>(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/StatusChartController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/StatusChartController.java index 71844041..938d6b43 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/StatusChartController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/StatusChartController.java @@ -33,8 +33,8 @@ import org.jfree.data.time.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; 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_HEIGHT = 150; - @RequestMapping(method = RequestMethod.GET) + @GetMapping public synchronized ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { String type = request.getParameter("type"); int index = ServletRequestUtils.getIntParameter(request, "index", 0); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/StatusController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/StatusController.java index 97325e95..cc82965c 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/StatusController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/StatusController.java @@ -26,8 +26,8 @@ import org.airsonic.player.util.FileUtil; import org.airsonic.player.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.support.RequestContextUtils; @@ -48,7 +48,7 @@ public class StatusController { @Autowired private StatusService statusService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { Map map = new HashMap<>(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/StreamController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/StreamController.java index 5c31ecb6..4c07a433 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/StreamController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/StreamController.java @@ -38,8 +38,8 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; import org.springframework.web.bind.ServletRequestBindingException; 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.RequestMethod; import javax.annotation.Nullable; import javax.servlet.http.HttpServletRequest; @@ -82,7 +82,7 @@ public class StreamController { @Autowired private SearchService searchService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { TransferStatus status = null; diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/TopController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/TopController.java index 5991020d..6fdd108c 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/TopController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/TopController.java @@ -26,8 +26,8 @@ import org.airsonic.player.service.SecurityService; import org.airsonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -49,7 +49,7 @@ public class TopController { @Autowired private SecurityService securityService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception { Map map = new HashMap<>(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/TranscodingSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/TranscodingSettingsController.java index 99916c68..0017e508 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/TranscodingSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/TranscodingSettingsController.java @@ -26,8 +26,9 @@ import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; @@ -49,7 +50,7 @@ public class TranscodingSettingsController { @Autowired private SettingsService settingsService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping public String doGet(Model model) throws Exception { Map map = new HashMap(); @@ -64,7 +65,7 @@ public class TranscodingSettingsController { return "transcodingSettings"; } - @RequestMapping(method = RequestMethod.POST) + @PostMapping public String doPost(HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception { String error = handleParameters(request, redirectAttributes); if(error != null) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/UploadController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/UploadController.java index 4e0ee662..722fe717 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/UploadController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/UploadController.java @@ -35,8 +35,8 @@ import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -71,7 +71,7 @@ public class UploadController { private SettingsService settingsService; public static final String UPLOAD_STATUS = "uploadStatus"; - @RequestMapping(method = { RequestMethod.POST }) + @PostMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { Map map = new HashMap<>(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/UserChartController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/UserChartController.java index b6145a87..3971993c 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/UserChartController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/UserChartController.java @@ -35,8 +35,8 @@ import org.jfree.data.category.CategoryDataset; import org.jfree.data.category.DefaultCategoryDataset; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -61,7 +61,7 @@ public class UserChartController extends AbstractChartController { public static final int IMAGE_MIN_HEIGHT = 200; private static final long BYTES_PER_MB = 1024L * 1024L; - @RequestMapping(method = RequestMethod.GET) + @GetMapping public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { String type = request.getParameter("type"); CategoryDataset dataset = createDataset(type); diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/UserSettingsController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/UserSettingsController.java index 6970f2e9..b64a623b 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/UserSettingsController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/UserSettingsController.java @@ -38,10 +38,11 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.ServletRequestBindingException; import org.springframework.web.bind.ServletRequestUtils; 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.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; @@ -73,7 +74,7 @@ public class UserSettingsController { binder.addValidators(userSettingsValidator); } - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected String displayForm(HttpServletRequest request, Model model) throws Exception { UserSettingsCommand command; if(!model.containsAttribute("command")) { @@ -129,7 +130,7 @@ public class UserSettingsController { return result; } - @RequestMapping(method = RequestMethod.POST) + @PostMapping protected String doSubmitAction(@ModelAttribute("command") @Validated UserSettingsCommand command, BindingResult bindingResult, RedirectAttributes redirectAttributes) throws Exception { if(!bindingResult.hasErrors()) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/VideoPlayerController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/VideoPlayerController.java index a63de246..bb0c6199 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/VideoPlayerController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/VideoPlayerController.java @@ -29,8 +29,8 @@ import org.airsonic.player.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.ServletRequestUtils; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -59,7 +59,7 @@ public class VideoPlayerController { @Autowired private SecurityService securityService; - @RequestMapping(method = RequestMethod.GET) + @GetMapping protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { User user = securityService.getCurrentUser(request);