1

I'm working on some shell scripts to configure GeoServer instances using the REST endpoints, but I've become stuck with the GeoWebCache caching defaults. Is there any way to modify the gwc-cs.xml file using the REST endpoints for GeoServer or GWC?

I've been through the docs, but I can only see how to change the global settings. I can't see how to change the default grid sets, cache layers by default, etc.

The best alternative I can think of is to copy an XML file to the GeoServer data-dir and call the reload REST endpoint to reload the config.

1 Answer 1

4

Have a look in the resource endpoint - on my machine http://localhost:8080/geoserver/rest/resource/gwc-gs.xml gives me, usually I GET it, edit and then PUT it back.

<?xml version="1.0"?>
<GeoServerGWCConfig>
  <version>1.1.0</version>
  <directWMSIntegrationEnabled>true</directWMSIntegrationEnabled>
  <WMSCEnabled>true</WMSCEnabled>
  <TMSEnabled>true</TMSEnabled>
  <securityEnabled>false</securityEnabled>
  <innerCachingEnabled>false</innerCachingEnabled>
  <persistenceEnabled>true</persistenceEnabled>
  <cacheProviderClass>
class org.geowebcache.storage.blobstore.memory.guava.GuavaCacheProvider
</cacheProviderClass>
  <cacheConfigurations>
    <entry>
      <string>
class org.geowebcache.storage.blobstore.memory.guava.GuavaCacheProvider
</string>
      <InnerCacheConfiguration>
        <hardMemoryLimit>16</hardMemoryLimit>
        <policy>NULL</policy>
        <concurrencyLevel>4</concurrencyLevel>
        <evictionTime>120</evictionTime>
      </InnerCacheConfiguration>
    </entry>
  </cacheConfigurations>
  <cacheLayersByDefault>true</cacheLayersByDefault>
  <cacheNonDefaultStyles>true</cacheNonDefaultStyles>
  <metaTilingX>4</metaTilingX>
  <metaTilingY>4</metaTilingY>
  <gutter>0</gutter>
  <defaultCachingGridSetIds>
    <string>EPSG:4326</string>
    <string>osgb</string>
    <string>EPSG:900913</string>
  </defaultCachingGridSetIds>
  <defaultCoverageCacheFormats>
    <string>image/png</string>
    <string>image/jpeg</string>
  </defaultCoverageCacheFormats>
  <defaultVectorCacheFormats>
    <string>image/png</string>
    <string>image/jpeg</string>
  </defaultVectorCacheFormats>
  <defaultOtherCacheFormats>
    <string>image/png</string>
    <string>image/jpeg</string>
  </defaultOtherCacheFormats>
  <lockProviderName>nioLock</lockProviderName>
</GeoServerGWCConfig>
1
  • Thats what I thought, and I can PUT the new gwc-gs.xml file in the right location. The problem then is the REST endpoint for geoserver/rest/reload and gwc/rest/reload do not seem to pick up the updated file. There is a another question about it here: gis.stackexchange.com/questions/133973/….
    – AEgman
    Feb 13, 2019 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.