Controller migration
This commit is contained in:
@@ -30,9 +30,12 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
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.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.ModelAndView;
|
||||||
import org.springframework.web.servlet.mvc.Controller;
|
|
||||||
|
|
||||||
import org.libresonic.player.domain.MediaFile;
|
import org.libresonic.player.domain.MediaFile;
|
||||||
import org.libresonic.player.domain.Player;
|
import org.libresonic.player.domain.Player;
|
||||||
@@ -47,15 +50,21 @@ import org.libresonic.player.util.StringUtil;
|
|||||||
*
|
*
|
||||||
* @author Sindre Mehus
|
* @author Sindre Mehus
|
||||||
*/
|
*/
|
||||||
public class HLSController implements Controller {
|
@Controller
|
||||||
|
@RequestMapping("/hls/**")
|
||||||
|
public class HLSController {
|
||||||
|
|
||||||
private static final int SEGMENT_DURATION = 10;
|
private static final int SEGMENT_DURATION = 10;
|
||||||
private static final Pattern BITRATE_PATTERN = Pattern.compile("(\\d+)(@(\\d+)x(\\d+))?");
|
private static final Pattern BITRATE_PATTERN = Pattern.compile("(\\d+)(@(\\d+)x(\\d+))?");
|
||||||
|
|
||||||
|
@Autowired
|
||||||
private PlayerService playerService;
|
private PlayerService playerService;
|
||||||
|
@Autowired
|
||||||
private MediaFileService mediaFileService;
|
private MediaFileService mediaFileService;
|
||||||
|
@Autowired
|
||||||
private SecurityService securityService;
|
private SecurityService securityService;
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.GET)
|
||||||
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
|
|
||||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
@@ -188,15 +197,4 @@ public class HLSController implements Controller {
|
|||||||
return contextPath;
|
return contextPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMediaFileService(MediaFileService mediaFileService) {
|
|
||||||
this.mediaFileService = mediaFileService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlayerService(PlayerService playerService) {
|
|
||||||
this.playerService = playerService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSecurityService(SecurityService securityService) {
|
|
||||||
this.securityService = securityService;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,11 +17,6 @@
|
|||||||
org.libresonic.player.validator,
|
org.libresonic.player.validator,
|
||||||
org.libresonic.player.security"/>
|
org.libresonic.player.security"/>
|
||||||
|
|
||||||
<bean id="hlsController" class="org.libresonic.player.controller.HLSController">
|
|
||||||
<property name="playerService" ref="playerService"/>
|
|
||||||
<property name="mediaFileService" ref="mediaFileService"/>
|
|
||||||
<property name="securityService" ref="securityService"/>
|
|
||||||
</bean>
|
|
||||||
<bean id="videoPlayerController" class="org.libresonic.player.controller.VideoPlayerController">
|
<bean id="videoPlayerController" class="org.libresonic.player.controller.VideoPlayerController">
|
||||||
<property name="viewName" value="videoPlayer"/>
|
<property name="viewName" value="videoPlayer"/>
|
||||||
<property name="mediaFileService" ref="mediaFileService"/>
|
<property name="mediaFileService" ref="mediaFileService"/>
|
||||||
@@ -101,7 +96,6 @@
|
|||||||
<prop key="/wap/download.view">downloadController</prop>
|
<prop key="/wap/download.view">downloadController</prop>
|
||||||
<prop key="/wap/**">wapController</prop>
|
<prop key="/wap/**">wapController</prop>
|
||||||
<prop key="/rest/**">restController</prop>
|
<prop key="/rest/**">restController</prop>
|
||||||
<prop key="/hls/**">hlsController</prop>
|
|
||||||
<prop key="/share/**">externalPlayerController</prop>
|
<prop key="/share/**">externalPlayerController</prop>
|
||||||
</props>
|
</props>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user