From 217caba28f0fbade140a6f2cecca2862e2d9d366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Cocula?= Date: Thu, 22 Dec 2016 21:49:44 +0100 Subject: [PATCH] Controller migration --- .../player/controller/ProxyController.java | 18 +++++++++++------- .../src/main/resources/libresonic-servlet.xml | 2 -- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/ProxyController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/ProxyController.java index 552aae50..4ced7605 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/ProxyController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/ProxyController.java @@ -19,11 +19,6 @@ */ package org.libresonic.player.controller; -import java.io.InputStream; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.commons.io.IOUtils; import org.apache.http.HttpStatus; import org.apache.http.client.config.RequestConfig; @@ -31,17 +26,26 @@ import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; 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.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.Controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; /** * A proxy for external HTTP requests. * * @author Sindre Mehus */ -public class ProxyController implements Controller { +@Controller +@RequestMapping("/proxy") +public class ProxyController { + @RequestMapping(method = RequestMethod.GET) public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { String url = ServletRequestUtils.getRequiredStringParameter(request, "url"); diff --git a/libresonic-main/src/main/resources/libresonic-servlet.xml b/libresonic-main/src/main/resources/libresonic-servlet.xml index 00671755..aaacd4ca 100644 --- a/libresonic-main/src/main/resources/libresonic-servlet.xml +++ b/libresonic-main/src/main/resources/libresonic-servlet.xml @@ -15,7 +15,6 @@ - @@ -126,7 +125,6 @@ multiController multiController videoPlayerController - proxyController statusChartController userChartController downloadController