Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GWC REST API fix to fill in the TileLayerInfo blanks when creating a TileLayer #208

Conversation

groldan
Copy link
Member

@groldan groldan commented Mar 3, 2022

To be raised as an issue upstream. Work around the behaivor
mismatch between GWC's REST API and GeoServer's GWC web-ui.

When creating a tile layer with the web-ui, the GeoServerTileLayerInfo
is populated with the defaults from GWCConfig (set in GWCSettings page).

When creating a tile layer through the REST API, it allows a minimal
payload but does not fill in the blanks with the defaults from GWConfig.

e.g., the following payload:

<GeoServerLayer><enabled>true</enabled><name>topp:states</name></GeoServerLayer>

results in an unsusable tile layer:

<?xml version="1.0" encoding="UTF-8"?>
<GeoServerLayer>
  <id>LayerInfoImpl-8fbb6079-2ee3-40b0-955a-2ccf1b8c2941</id>
  <enabled>true</enabled>
  <name>topp:states</name>
  <mimeFormats/>
  <gridSubsets/>
  <metaWidthHeight>
    <int>0</int>
    <int>0</int>
  </metaWidthHeight>
  <expireCache>0</expireCache>
  <expireClients>0</expireClients>
  <parameterFilters/>
  <gutter>0</gutter>
  <cacheWarningSkips/>
</GeoServerLayer>

where from the default tile layer settings it should be more like:

<GeoServerLayer>
  <id>LayerInfoImpl-8fbb6079-2ee3-40b0-955a-2ccf1b8c2941</id>
  <enabled>true</enabled>
  <name>topp:states</name>
  <mimeFormats>
    <string>image/png</string>
    <string>image/jpeg</string>
  </mimeFormats>
  <gridSubsets>
    <gridSubset>
      <gridSetName>EPSG:4326</gridSetName>
    </gridSubset>
    <gridSubset>
      <gridSetName>EPSG:900913</gridSetName>
    </gridSubset>
  </gridSubsets>
  <metaWidthHeight>
    <int>4</int>
    <int>4</int>
  </metaWidthHeight>
  <expireCache>0</expireCache>
  <expireClients>0</expireClients>
  <parameterFilters>
    <styleParameterFilter>
      <key>STYLES</key>
      <defaultValue></defaultValue>
    </styleParameterFilter>
  </parameterFilters>
  <gutter>0</gutter>
  <cacheWarningSkips/>
</GeoServerLayer>

…TileLayer

To be raised as an issue upstream. Work around the behaivor
mismatch between GWC's REST API and GeoServer's GWC web-ui.

When creating a tile layer with the web-ui, the GeoServerTileLayerInfo
is populated with the defaults from GWCConfig (set in GWCSettings page).

When creating a tile layer through the REST API, it allows a minimal
payload but does not fill in the blanks with the defaults from GWConfig.

e.g., the following payload:

```
<GeoServerLayer><enabled>true</enabled><name>topp:states</name></GeoServerLayer>
```

results in an unsusable tile layer:

```
<?xml version="1.0" encoding="UTF-8"?>
<GeoServerLayer>
  <id>LayerInfoImpl-8fbb6079-2ee3-40b0-955a-2ccf1b8c2941</id>
  <enabled>true</enabled>
  <name>topp:states</name>
  <mimeFormats/>
  <gridSubsets/>
  <metaWidthHeight>
    <int>0</int>
    <int>0</int>
  </metaWidthHeight>
  <expireCache>0</expireCache>
  <expireClients>0</expireClients>
  <parameterFilters/>
  <gutter>0</gutter>
  <cacheWarningSkips/>
</GeoServerLayer>
```

where from the default tile layer settings it should be more like:

```
<GeoServerLayer>
  <id>LayerInfoImpl-8fbb6079-2ee3-40b0-955a-2ccf1b8c2941</id>
  <enabled>true</enabled>
  <name>topp:states</name>
  <mimeFormats>
    <string>image/png</string>
    <string>image/jpeg</string>
  </mimeFormats>
  <gridSubsets>
    <gridSubset>
      <gridSetName>EPSG:4326</gridSetName>
    </gridSubset>
    <gridSubset>
      <gridSetName>EPSG:900913</gridSetName>
    </gridSubset>
  </gridSubsets>
  <metaWidthHeight>
    <int>4</int>
    <int>4</int>
  </metaWidthHeight>
  <expireCache>0</expireCache>
  <expireClients>0</expireClients>
  <parameterFilters>
    <styleParameterFilter>
      <key>STYLES</key>
      <defaultValue></defaultValue>
    </styleParameterFilter>
  </parameterFilters>
  <gutter>0</gutter>
  <cacheWarningSkips/>
</GeoServerLayer>
```
@groldan groldan added the bug Something isn't working label Mar 3, 2022
@groldan groldan merged commit e473c5e into geoserver:main Mar 3, 2022
@groldan groldan deleted the bug/gs_gwc_rest_api_doesnt_fill_in_blanks_in_tilelayer_config branch March 3, 2022 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant