You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/01/15 19:25:14 UTC

[isis] branch master updated: ISIS-2158: add demo-app launch option 'ContextPath' (also consider env)

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 0c20a97  ISIS-2158: add demo-app launch option 'ContextPath' (also consider env)
0c20a97 is described below

commit 0c20a97bfe1f71a9c8ebc1192ebb722c940eda5b
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Jan 15 20:25:03 2020 +0100

    ISIS-2158: add demo-app launch option 'ContextPath' (also consider env)
---
 examples/demo/src/main/java/demoapp/webapp/DemoApp.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/examples/demo/src/main/java/demoapp/webapp/DemoApp.java b/examples/demo/src/main/java/demoapp/webapp/DemoApp.java
index f741509..d3d6895 100644
--- a/examples/demo/src/main/java/demoapp/webapp/DemoApp.java
+++ b/examples/demo/src/main/java/demoapp/webapp/DemoApp.java
@@ -18,6 +18,8 @@
  */
 package demoapp.webapp;
 
+import java.util.Optional;
+
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.web.server.WebServerFactoryCustomizer;
@@ -141,7 +143,9 @@ public class DemoApp extends SpringBootServletInitializer {
         @Bean
         public WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> webServerFactoryCustomizer() {
             return factory -> {
-                val contextPath = System.getProperty("ContextPath");
+                val contextPath = Optional
+                        .ofNullable(System.getProperty("ContextPath"))
+                        .orElse(System.getenv("ContextPath")); // fallback
                 if(contextPath!=null) {
                     factory.setContextPath(contextPath);
                     log.info("Setting context path to '{}'", contextPath);