Commit 9c5f9878 authored by ipatini's avatar ipatini
Browse files

EMS: Control Service: Changed String[] fields to List<String> in...

EMS: Control Service: Changed String[] fields to List<String> in 'StaticResourceProperties' class and updated code accordingly. Fixed StaticResourceProperties serialization to Map<String,Object> in 'EmsInfoServiceImpl'.
parent 35885daa
......@@ -171,7 +171,16 @@ public class EmsInfoServiceImpl implements IEmsInfoService {
controlServiceInfo.put("prop-debug-flags",debugFlags);
}
if (staticResourceProperties!=null) {
controlServiceInfo.put("prop-static-resource", staticResourceProperties);
Map<String,Object> staticResourceCfg = new LinkedHashMap<>();
staticResourceCfg.put("favicon-context", staticResourceProperties.getFaviconContext());
staticResourceCfg.put("favicon-path", staticResourceProperties.getFaviconPath());
staticResourceCfg.put("resource-context", staticResourceProperties.getResourceContext());
staticResourceCfg.put("resource-path", staticResourceProperties.getResourcePath());
staticResourceCfg.put("resource-redirect", staticResourceProperties.getResourceRedirect());
staticResourceCfg.put("resource-redirects", staticResourceProperties.getResourceRedirects());
staticResourceCfg.put("logs-context", staticResourceProperties.getLogsContext());
staticResourceCfg.put("logs-path", staticResourceProperties.getLogsPath());
controlServiceInfo.put("prop-static-resource", staticResourceCfg);
}
metrics.put(CONTROL_INFO_PROVIDER, controlServiceInfo);
......
......@@ -16,6 +16,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.validation.annotation.Validated;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Slf4j
......@@ -28,11 +29,11 @@ public class StaticResourceProperties {
private String faviconPath;
private String resourceContext = "/resources/**";
private String[] resourcePath;
private List<String> resourcePath;
private String resourceRedirect;
private Map<String,String> resourceRedirects = new LinkedHashMap<>();
private String logsContext = "/logs/**";
private String[] logsPath;
private List<String> logsPath;
}
......@@ -23,6 +23,7 @@ import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.List;
import java.util.Map;
@Slf4j
......@@ -48,20 +49,20 @@ public class StaticResourceConfiguration implements WebMvcConfigurer, Initializi
.addResourceLocations(faviconPath);
}
String resourceContext = properties.getResourceContext();
String[] resourcePath = properties.getResourcePath();
if (resourcePath != null && resourcePath.length > 0) {
List<String> resourcePath = properties.getResourcePath();
if (resourcePath != null && resourcePath.size() > 0) {
log.info("Serving static content from: {} --> {}", resourceContext, resourcePath);
registry
.addResourceHandler(resourceContext)
.addResourceLocations(resourcePath);
.addResourceLocations(resourcePath.toArray(new String[0]));
}
String logsContext = properties.getLogsContext();
String[] logsPath = properties.getLogsPath();
if (logsPath != null && logsPath.length > 0) {
List<String> logsPath = properties.getLogsPath();
if (logsPath != null && logsPath.size() > 0) {
log.info("Serving logs from: {} --> {}", logsContext, logsPath);
registry
.addResourceHandler(logsContext)
.addResourceLocations(logsPath);
.addResourceLocations(logsPath.toArray(new String[0]));
}
if (controlServiceProperties.isEventDebugEnabled()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment