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:12:00 UTC
[isis] branch master updated: ISIS-2158: add demo-app launch option
'ContextPath'
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 eb46a7d ISIS-2158: add demo-app launch option 'ContextPath'
eb46a7d is described below
commit eb46a7d9c38ad6d7f6b204c9cdbcd479dbb8b2ba
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Jan 15 20:11:53 2020 +0100
ISIS-2158: add demo-app launch option 'ContextPath'
---
.../demo/src/main/java/demoapp/webapp/DemoApp.java | 30 +++++++++++++++++++---
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/examples/demo/src/main/java/demoapp/webapp/DemoApp.java b/examples/demo/src/main/java/demoapp/webapp/DemoApp.java
index a97409c..f741509 100644
--- a/examples/demo/src/main/java/demoapp/webapp/DemoApp.java
+++ b/examples/demo/src/main/java/demoapp/webapp/DemoApp.java
@@ -18,10 +18,10 @@
*/
package demoapp.webapp;
-import javax.inject.Singleton;
-
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.server.WebServerFactoryCustomizer;
+import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -49,6 +49,9 @@ import org.apache.isis.viewer.restfulobjects.jaxrsresteasy4.IsisModuleViewerRest
import org.apache.isis.viewer.restfulobjects.viewer.IsisModuleViewerRestfulObjectsViewer;
import org.apache.isis.viewer.wicket.viewer.IsisModuleViewerWicketViewer;
+import lombok.val;
+import lombok.extern.log4j.Log4j2;
+
import demoapp.dom.DemoModule;
import demoapp.utils.LibraryPreloadingService;
@@ -59,6 +62,7 @@ import demoapp.utils.LibraryPreloadingService;
@Import({
DemoApp.AppManifest.class,
})
+@Log4j2
public class DemoApp extends SpringBootServletInitializer {
/**
@@ -114,7 +118,7 @@ public class DemoApp extends SpringBootServletInitializer {
)
public static class AppManifest {
- @Bean @Singleton
+ @Bean
public SecurityModuleConfig securityModuleConfigBean() {
return SecurityModuleConfig.builder()
.adminUserName("sven")
@@ -123,10 +127,28 @@ public class DemoApp extends SpringBootServletInitializer {
.build();
}
- @Bean @Singleton
+ @Bean
public PermissionsEvaluationService permissionsEvaluationService() {
return new PermissionsEvaluationServiceAllowBeatsVeto();
}
+
+ /**
+ * If available from {@code System.getProperty("ContextPath")},
+ * sets the context path for the web server. The context should start with a "/" character
+ * but not end with a "/" character. The default context path can be
+ * specified using an empty string.
+ */
+ @Bean
+ public WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> webServerFactoryCustomizer() {
+ return factory -> {
+ val contextPath = System.getProperty("ContextPath");
+ if(contextPath!=null) {
+ factory.setContextPath(contextPath);
+ log.info("Setting context path to '{}'", contextPath);
+ }
+ };
+ }
+
}
}