-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #471 from groldan/webui/default_homepage_selection…
…_mode_text Make GeoServerHomePage.selectionMode system property default to TEXT
- Loading branch information
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...bui/src/main/java/org/geoserver/cloud/autoconfigure/web/core/WebUIContextInitializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* (c) 2024 Open Source Geospatial Foundation - all rights reserved This code is licensed under the | ||
* GPL 2.0 license, available at the root application directory. | ||
*/ | ||
package org.geoserver.cloud.autoconfigure.web.core; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import org.springframework.context.ApplicationContextInitializer; | ||
import org.springframework.context.ConfigurableApplicationContext; | ||
import org.springframework.util.StringUtils; | ||
import org.springframework.web.context.support.GenericWebApplicationContext; | ||
|
||
/** | ||
* @since 1.8.2 | ||
*/ | ||
@Slf4j | ||
public class WebUIContextInitializer | ||
implements ApplicationContextInitializer<ConfigurableApplicationContext> { | ||
|
||
@Override | ||
public void initialize(ConfigurableApplicationContext applicationContext) { | ||
// run once for the webapp context, ignore the actuator context | ||
if (!(applicationContext instanceof GenericWebApplicationContext)) { | ||
return; | ||
} | ||
setHomePageSelectionMode(); | ||
} | ||
|
||
private void setHomePageSelectionMode() { | ||
|
||
String systemProp = System.getProperty("GeoServerHomePage.selectionMode"); | ||
if (StringUtils.hasText(systemProp)) { | ||
log.info( | ||
"GeoServerHomePage.selectionMode set to '{}' through system property", | ||
systemProp); | ||
} else { | ||
String selectionMode = "TEXT"; | ||
log.info("GeoServerHomePage.selectionMode set to '{}' as default value", selectionMode); | ||
System.setProperty("GeoServerHomePage.selectionMode", selectionMode); | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/apps/geoserver/webui/src/main/resources/META-INF/spring.factories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# Initializers | ||
org.springframework.context.ApplicationContextInitializer=\ | ||
org.geoserver.cloud.autoconfigure.web.core.WebUIContextInitializer | ||
|
||
# Auto Configure | ||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ | ||
org.geoserver.cloud.autoconfigure.web.core.WebUIApplicationAutoConfiguration,\ | ||
org.geoserver.cloud.autoconfigure.web.cloudnative.CloudNativeUIAutoConfiguration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters