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.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");
@@ -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);
@@ -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"));
@@ -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);
@@ -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);
@@ -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");
@@ -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);
@@ -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<String, Object> map = new HashMap<String, Object>();
@@ -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);
@@ -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 {
@@ -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);
@@ -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");
@@ -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");
@@ -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<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.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());
@@ -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) {
@@ -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", "*");
@@ -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<String, Object> map = new HashMap<>();
@@ -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);
@@ -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";
}
@@ -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));
@@ -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<String, Object> 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);
@@ -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<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.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.
@@ -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<String, Object> map = new HashMap<>();
@@ -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);
@@ -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 {
@@ -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<String, Object> map = new HashMap<>();
@@ -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()) {
@@ -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");
}
@@ -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);
@@ -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());
@@ -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());
@@ -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);
@@ -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) {
@@ -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<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.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<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.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<String, Object> map = new HashMap<>();
@@ -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<String, Object> map = new HashMap<>();
@@ -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();
@@ -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()));
@@ -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");
@@ -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,
@@ -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<String, Object> map = new HashMap<>();
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.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 {
@@ -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");
@@ -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");
@@ -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);
@@ -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<MediaFile> files = getMediaFiles(request);
@@ -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<String, Object> map = new HashMap<String, Object>();
@@ -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);
@@ -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<String, Object> map = new HashMap<String, Object>();
@@ -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);
@@ -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<String, Object> map = new HashMap<>();
@@ -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);
@@ -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<String, Object> map = new HashMap<>();
@@ -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;
@@ -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<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.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<String, Object> map = new HashMap<String, Object>();
@@ -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) {
@@ -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<String, Object> map = new HashMap<>();
@@ -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);
@@ -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()) {
@@ -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);