openvidu-server: serve Dashboard at "/dashboard" instead of "/"

pull/437/head
pabloFuente 2020-04-16 19:37:56 +02:00
parent 27a9e3ef7d
commit bd6cb6b3da
3 changed files with 56 additions and 4 deletions

View File

@ -0,0 +1,40 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package io.openvidu.server.resources;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* This class changes the path where static files are served from / to
* /dashboard. Entrypoint file index.html must have tag <base href="/dashboard/">
*
* @author Pablo Fuente (pablofuenteperez@gmail.com)
*/
@Configuration
public class DashboardResourceHandler extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/dashboard").setViewName("redirect:/dashboard/");
registry.addViewController("/dashboard/").setViewName("forward:/dashboard/index.html");
super.addViewControllers(registry);
}
}

View File

@ -15,7 +15,7 @@
*
*/
package io.openvidu.server.recording;
package io.openvidu.server.resources;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@ -25,9 +25,15 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import io.openvidu.server.config.OpenviduConfig;
/**
* This class serves custom recording layouts from host folder indicated in
* configuration property openvidu.recording.custom-layout
*
* @author Pablo Fuente (pablofuenteperez@gmail.com)
*/
@Configuration
@ConditionalOnProperty(name = "openvidu.recording", havingValue = "true")
public class CustomLayoutsHttpHandler implements WebMvcConfigurer {
public class RecordingCustomLayoutsResourceHandler implements WebMvcConfigurer {
@Autowired
OpenviduConfig openviduConfig;

View File

@ -15,7 +15,7 @@
*
*/
package io.openvidu.server.recording;
package io.openvidu.server.resources;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
@ -24,8 +24,14 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import io.openvidu.server.config.OpenviduConfig;
/**
* This class serves recording files from host folder indicated in configuration
* property openvidu.recording.path
*
* @author Pablo Fuente (pablofuenteperez@gmail.com)
*/
@Configuration
public class RecordingsHttpHandler implements WebMvcConfigurer {
public class RecordingsResourceHandler implements WebMvcConfigurer {
@Autowired
OpenviduConfig openviduConfig;