Skip to content

Commit

Permalink
[GEOS-8438] GWC syles legends not correctly encoded when usin a virtu…
Browse files Browse the repository at this point in the history
…al service
  • Loading branch information
Nuno Oliveira committed Dec 8, 2017
1 parent dbd182c commit ec96235
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ public Map<String, org.geowebcache.config.legends.LegendInfo> getLayerLegendsInf
.withFormat(finalFormat)
.withMinScale(scalesDenominator.getMinimum())
.withMaxScale(scalesDenominator.getMaximum())
.withCompleteUrl(buildURL(baseUrl, "ows", params, URLMangler.URLType.SERVICE));
.withCompleteUrl(buildURL(baseUrl, "ows", params, URLMangler.URLType.RESOURCE));
legends.put(styleInfo.prefixedName(), gwcLegendInfo.build());
}
}
Expand Down
15 changes: 15 additions & 0 deletions src/gwc/src/test/java/org/geoserver/gwc/GWCIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.geoserver.catalog.LayerInfo;
import org.geoserver.catalog.ResourceInfo;
import org.geoserver.catalog.WorkspaceInfo;
import org.geoserver.catalog.impl.WorkspaceInfoImpl;
import org.geoserver.config.GeoServerDataDirectory;
import org.geoserver.data.test.MockData;
import org.geoserver.data.test.SystemTestData;
Expand Down Expand Up @@ -1113,6 +1114,20 @@ public void testWmtsGetCapabilitiesRequest() throws Exception {
result = WMTS_XPATH_10.evaluate("count(//wmts:Contents/wmts:Layer/wmts:Style/" +
"wmts:LegendURL[@minScaleDenominator='100000.0'][@maxScaleDenominator='300000.0'])", document);
assertThat(Integer.parseInt(result), greaterThan(0));
// check that legend URI are correctly encoded in the context of a local workspace
WorkspaceInfo workspace = getCatalog().getWorkspaceByName(TEST_WORKSPACE_NAME);
assertThat(workspace, notNullValue());
LocalWorkspace.set(workspace);
try {
response = getAsServletResponse(TEST_WORKSPACE_NAME + "/gwc/service/wmts?request=GetCapabilities");
document = dom(response, false);
result = WMTS_XPATH_10.evaluate("count(//wmts:Contents/wmts:Layer/wmts:Style/" +
"wmts:LegendURL[contains(@xlink:href,'geoserver/" + TEST_WORKSPACE_NAME + "/ows')])", document);
assertThat(Integer.parseInt(result), greaterThan(0));
} finally {
// make sure we remove the local workspace
LocalWorkspace.set(null);
}
}

@Test
Expand Down

0 comments on commit ec96235

Please sign in to comment.