package alien4cloud.webconfiguration;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class StaticResourcesConfiguration extends WebMvcConfigurerAdapter {
    @Value("file:///${directories.alien}/${directories.csar_repository}/")
    private String toscaRepo;
    @Value("file:///${directories.alien}/work/plugins/ui/")
    private String pluginsUi;

    public final static String PLUGIN_STATIC_ENDPOINT = "/static/plugins/";

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/tosca/**").addResourceLocations(toscaRepo);
        registry.addResourceHandler(PLUGIN_STATIC_ENDPOINT + "**").addResourceLocations(pluginsUi);
    }
}

@@ -32,16 +32,80 @@
 ation;%0A%0A
+import java.nio.file.Paths;%0A%0Aimport lombok.extern.slf4j.Slf4j;%0A%0A
 import o
@@ -381,16 +381,23 @@
 apter;%0A%0A
+@Slf4j%0A
 @Configu
@@ -487,32 +487,24 @@
     @Value(%22
-file:///
 $%7Bdirectorie
@@ -592,16 +592,8 @@
 ue(%22
-file:///
 $%7Bdi
@@ -822,16 +822,467 @@
 stry) %7B%0A
+        String prefix = %22file:///%22;%0A        // resource locations must be full path and not relatives%0A        String absToscaRepo = prefix.concat(Paths.get(toscaRepo).toAbsolutePath().toString()).concat(%22/%22);%0A        String absPluginUi = prefix.concat(Paths.get(pluginsUi).toAbsolutePath().toString()).concat(%22/%22);%0A        log.info(%22Serving %7B%7D as tosca repo content.%22, absToscaRepo);%0A        log.info(%22Serving %7B%7D as plugin ui content.%22, absPluginUi);%0A
         
@@ -1350,17 +1350,20 @@
 cations(
-t
+absT
 oscaRepo
@@ -1453,23 +1453,25 @@
 cations(
-p
+absP
 lugin
-s
 Ui);%0A   
@@ -1474,9 +1474,8 @@
 %0A    %7D%0A%7D
-%0A

Fix an issue causing alien4cloud static resources (csar and plugin) to be unavailable when main directory was expressed using relative paths.