From 50ee56044bfff56e4a270559e06175fed1186da4 Mon Sep 17 00:00:00 2001 From: Sean Arms <67096+lesserwhirls@users.noreply.github.com> Date: Fri, 20 Dec 2024 17:14:20 -0700 Subject: [PATCH] Support godiva3 configuration Allow for godiva3 configuration using godiva3.properties. Fixes Unidata/tds#469 --- .../src/site/pages/thredds/WmsRef.md | 10 +++++-- .../src/site/pages/thredds/WmsRef.md | 10 +++++-- .../src/site/pages/thredds/WmsRef.md | 10 +++++-- .../java/thredds/server/wms/TestGodiva3.java | 26 +++++++++++++++++++ .../thredds/server/config/TdsContext.java | 3 +++ tds/src/main/webapp/WEB-INF/web.xml | 15 +++++++++++ .../test/content/thredds/godiva3.properties | 21 +++++++++++++++ 7 files changed, 89 insertions(+), 6 deletions(-) create mode 100644 tds/src/integrationTests/java/thredds/server/wms/TestGodiva3.java create mode 100644 tds/src/test/content/thredds/godiva3.properties diff --git a/docs/adminguide/src/site/pages/thredds/WmsRef.md b/docs/adminguide/src/site/pages/thredds/WmsRef.md index 4f28dbc734..49e0eccf50 100644 --- a/docs/adminguide/src/site/pages/thredds/WmsRef.md +++ b/docs/adminguide/src/site/pages/thredds/WmsRef.md @@ -1,6 +1,6 @@ --- title: TDS Web Map Service (WMS) -last_updated: 2021-08-06 +last_updated: 2024-12-20 sidebar: admin_sidebar toc: false permalink: adding_wms.html @@ -52,12 +52,18 @@ WMS clients may not be able to directly use the THREDDS catalogs to find the WMS Additional server level WMS configuration options can be set in the `threddsConfig.xml` file (see the [WMS Service](../adminguide/tds_config_ref.html) section of the TDS Configuration File Reference documentation). Further WMS configuration properties are set in the wmsConfig.xml file. These properties are mainly related with styling of WMS images. -Similar to the `threddsConfig.xml file`, the WMS configuration file (wmsConfig.xml) is found in the `${tds.content.root.path}/thredds` directory. +Similar to the `threddsConfig.xml` file, the WMS configuration file (wmsConfig.xml) is found in the `${tds.content.root.path}/thredds` directory. A detailed description of the wmsConfig.xml file can be on the [Customizing WMS](customizing_wms.html) reference page. If you are installing a new TDS, you should find a default `wmsConfig.xml` file (along with other configuration files) in the `${tds.content.root.path}/thredds` directory after you first deploy the TDS. If a copy of the file is missing in the expected location, you can obtain a fresh copy from `${tomcat_home}/webapps/thredds/WEB-INF/altContent/startup/wmsConfig.xml`. +## Godiva3 configuration + +Godiva3 has a few configuration options that may be useful, such as changing the map size or adding new base layers. +Similar to the `wmsConfig.xml` file, the Godiva3 configuration file (`godiva3.properties`) is found in the `${tds.content.root.path}/thredds` directory. +Configuration options can be found in the [ncWMS documentation](https://reading-escience-centre.gitbooks.io/ncwms-user-guide/content/03-config.html#server){:target="_blank"}. + ## Change to CRS List in WMS GetCapabilities Documents The number of CRS listed in the WMS GetCapabilities documents has been reduced between TDS 4.1 and 4.2. diff --git a/docs/quickstart/src/site/pages/thredds/WmsRef.md b/docs/quickstart/src/site/pages/thredds/WmsRef.md index 2dca5ac915..9acdb0cf48 100644 --- a/docs/quickstart/src/site/pages/thredds/WmsRef.md +++ b/docs/quickstart/src/site/pages/thredds/WmsRef.md @@ -1,6 +1,6 @@ --- title: TDS Web Map Service (WMS) -last_updated: 2020-11-26 +last_updated: 2024-12-20 sidebar: quickstart_sidebar toc: false permalink: adding_wms.html @@ -42,12 +42,18 @@ Additional WMS configuration options can be set in the `threddsConfig.xml` file. Further WMS configuration properties are set in the wmsConfig.xml file. These properties are mainly related with styling of WMS images. -Similar to the `threddsConfig.xml file`, the WMS configuration file (wmsConfig.xml) is found in the `$tds.content.root.path{}/content/thredds` directory. +Similar to the `threddsConfig.xml` file, the WMS configuration file (wmsConfig.xml) is found in the `$tds.content.root.path{}/content/thredds` directory. A detailed description of the wmsConfig.xml file can be on the [Customizing WMS](../adminguide/customizing_wms.html) reference page. If you are installing a new TDS, you should find a default `wmsConfig.xml` file (along with other configuration files) in your content`/thredds` directory after you first deploy the TDS. If you are upgrading from a TDS version before version `4.2.20100615.*`, you will have to copy the default file from `${tomcat_home}/webapps/thredds/WEB-INF/altContent/startup/wmsConfig.xml`. +## Godiva3 configuration + +Godiva3 has a few configuration options that may be useful, such as changing the map size or adding new base layers. +Similar to the `wmsConfig.xml` file, the Godiva3 configuration file (`godiva3.properties`) is found in the `${tds.content.root.path}/thredds` directory. +Configuration options can be found in the [ncWMS documentation](https://reading-escience-centre.gitbooks.io/ncwms-user-guide/content/03-config.html#server){:target="_blank"}. + ## Change to CRS List in WMS GetCapabilities Documents The number of CRS listed in the WMS GetCapabilities documents has been reduced between TDS 4.1 and 4.2. diff --git a/docs/userguide/src/site/pages/thredds/WmsRef.md b/docs/userguide/src/site/pages/thredds/WmsRef.md index 55876fdc85..c4fd6378dc 100644 --- a/docs/userguide/src/site/pages/thredds/WmsRef.md +++ b/docs/userguide/src/site/pages/thredds/WmsRef.md @@ -1,6 +1,6 @@ --- title: TDS Web Map Service (WMS) -last_updated: 2020-08-24 +last_updated: 2024-12-20 sidebar: user_sidebar toc: false permalink: adding_wms.html @@ -42,12 +42,18 @@ Additional WMS configuration options can be set in the `threddsConfig.xml` file. Further WMS configuration properties are set in the wmsConfig.xml file. These properties are mainly related with styling of WMS images. -Similar to the `threddsConfig.xml file`, the WMS configuration file (wmsConfig.xml) is found in the `$tds.content.root.path{}/content/thredds` directory. +Similar to the `threddsConfig.xml` file, the WMS configuration file (wmsConfig.xml) is found in the `$tds.content.root.path{}/content/thredds` directory. A detailed description of the wmsConfig.xml file can be found at the MyOcean "Detailed WMS Configuration" page. If you are installing a new TDS, you should find a default `wmsConfig.xml` file (along with other configuration files) in your content`/thredds` directory after you first deploy the TDS. If you are upgrading from a TDS version before version `4.2.20100615.*`, you will have to copy the default file from `${tomcat_home}/webapps/thredds/WEB-INF/altContent/startup/wmsConfig.xml`. +## Godiva3 configuration + +Godiva3 has a few configuration options that may be useful, such as changing the map size or adding new base layers. +Similar to the `wmsConfig.xml` file, the Godiva3 configuration file (`godiva3.properties`) is found in the `${tds.content.root.path}/thredds` directory. +Configuration options can be found in the [ncWMS documentation](https://reading-escience-centre.gitbooks.io/ncwms-user-guide/content/03-config.html#server){:target="_blank"}. + ## Change to CRS List in WMS GetCapabilities Documents The number of CRS listed in the WMS GetCapabilities documents has been reduced between TDS 4.1 and 4.2. diff --git a/tds/src/integrationTests/java/thredds/server/wms/TestGodiva3.java b/tds/src/integrationTests/java/thredds/server/wms/TestGodiva3.java new file mode 100644 index 0000000000..50475e0b9c --- /dev/null +++ b/tds/src/integrationTests/java/thredds/server/wms/TestGodiva3.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 1998-2024 University Corporation for Atmospheric Research/Unidata + * See LICENSE.txt for license information. + */ + +package thredds.server.wms; + +import static com.google.common.truth.Truth.assertThat; + +import jakarta.servlet.http.HttpServletResponse; +import java.nio.charset.StandardCharsets; +import org.junit.Test; +import thredds.test.util.TestOnLocalServer; + + +public class TestGodiva3 { + + @Test + public void testGodiva3GetConfig() { + String endpoint = TestOnLocalServer.withHttpPath("/getconfig"); + byte[] result = + TestOnLocalServer.getContent(endpoint, HttpServletResponse.SC_OK, "application/json;charset=iso-8859-1"); + String jsonStr = new String(result, StandardCharsets.ISO_8859_1); + assertThat(jsonStr).isEqualTo("{\"mapWidth\":1024,\"mapHeight\":512}"); + } +} diff --git a/tds/src/main/java/thredds/server/config/TdsContext.java b/tds/src/main/java/thredds/server/config/TdsContext.java index 2da087f666..b7c1eed1db 100644 --- a/tds/src/main/java/thredds/server/config/TdsContext.java +++ b/tds/src/main/java/thredds/server/config/TdsContext.java @@ -224,6 +224,9 @@ public void afterPropertiesSet() { } } + // set configDir for use by the godiva3 config servlet + servletContext.setAttribute("configDir", this.threddsDirectory.getAbsolutePath()); + /* * places to look for catalogs ?? * List chain = new ArrayList<>(); diff --git a/tds/src/main/webapp/WEB-INF/web.xml b/tds/src/main/webapp/WEB-INF/web.xml index 72c3107fb3..303e8b50af 100644 --- a/tds/src/main/webapp/WEB-INF/web.xml +++ b/tds/src/main/webapp/WEB-INF/web.xml @@ -132,6 +132,21 @@ + + + + godiva3config + uk.ac.rdg.resc.godiva.server.ConfigServlet + 2 + + + + godiva3config + /getconfig + + + +