From a7f3096aab7f7ce24704b943d8f59f66094668ee Mon Sep 17 00:00:00 2001 From: Nico Matentzoglu Date: Thu, 13 Aug 2020 17:31:42 +0100 Subject: [PATCH 1/2] First attempt at fixing custom logo issue --- .../main/java/uk/ac/ebi/spot/config/OxOWebMvcConfig.java | 6 ++++++ .../ac/ebi/spot/controller/ui/CustomisationProperties.java | 2 +- oxo-web/src/main/resources/templates/fragments/header.html | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/oxo-web/src/main/java/uk/ac/ebi/spot/config/OxOWebMvcConfig.java b/oxo-web/src/main/java/uk/ac/ebi/spot/config/OxOWebMvcConfig.java index a204683..d4af591 100644 --- a/oxo-web/src/main/java/uk/ac/ebi/spot/config/OxOWebMvcConfig.java +++ b/oxo-web/src/main/java/uk/ac/ebi/spot/config/OxOWebMvcConfig.java @@ -5,6 +5,8 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.*; + /** * @author Simon Jupp @@ -33,4 +35,8 @@ public void configurePathMatch(PathMatchConfigurer configurer) { } + + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/custom/**").addResourceLocations("file:" + System.getProperty("oxo.custom")+"/"); + } } diff --git a/oxo-web/src/main/java/uk/ac/ebi/spot/controller/ui/CustomisationProperties.java b/oxo-web/src/main/java/uk/ac/ebi/spot/controller/ui/CustomisationProperties.java index fbed96a..c8bbb2b 100644 --- a/oxo-web/src/main/java/uk/ac/ebi/spot/controller/ui/CustomisationProperties.java +++ b/oxo-web/src/main/java/uk/ac/ebi/spot/controller/ui/CustomisationProperties.java @@ -13,7 +13,7 @@ public class CustomisationProperties { @Value("${oxo.customisation.debrand:false}") private boolean debrand; - @Value("${oxo.customisation.logo:/img/OXO_logo_2017_colour_background.png") + @Value("${oxo.customisation.logo:/img/OXO_logo_2017_colour_background.png}") private String logo; @Value("${oxo.customisation.title:Ontology Xref Service}") diff --git a/oxo-web/src/main/resources/templates/fragments/header.html b/oxo-web/src/main/resources/templates/fragments/header.html index 80257ae..47dcb20 100644 --- a/oxo-web/src/main/resources/templates/fragments/header.html +++ b/oxo-web/src/main/resources/templates/fragments/header.html @@ -21,7 +21,7 @@
- +
From 6c045c22451e236a923ac9a39fa7540b66b58c31 Mon Sep 17 00:00:00 2001 From: Nico Matentzoglu Date: Thu, 13 Aug 2020 18:22:49 +0100 Subject: [PATCH 2/2] Update OxOWebMvcConfig.java --- .../src/main/java/uk/ac/ebi/spot/config/OxOWebMvcConfig.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/oxo-web/src/main/java/uk/ac/ebi/spot/config/OxOWebMvcConfig.java b/oxo-web/src/main/java/uk/ac/ebi/spot/config/OxOWebMvcConfig.java index d4af591..872bbf8 100644 --- a/oxo-web/src/main/java/uk/ac/ebi/spot/config/OxOWebMvcConfig.java +++ b/oxo-web/src/main/java/uk/ac/ebi/spot/config/OxOWebMvcConfig.java @@ -37,6 +37,9 @@ public void configurePathMatch(PathMatchConfigurer configurer) { } public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("/custom/**").addResourceLocations("file:" + System.getProperty("oxo.custom")+"/"); + if(System.getenv("OXO_CUSTOM")!=null) { + String resource = "file:" + System.getenv("OXO_CUSTOM")+"/"; + registry.addResourceHandler("/custom/**").addResourceLocations(resource); + } } }