private String adaptQueryUri(Catalog catalog, String queryUri, String workspaceName) { // remove the virtual service workspace from the URL queryUri = queryUri.replace(workspaceName + "/", ""); // prefix layers in the URI with the local workspace prefix Matcher matcher = URI_LAYER_PATTERN.matcher(requestUri); if (!matcher.find()) { // no layers in the URI, we are done return queryUri; } // we have layers in the URI let's adapt them String layerName = matcher.group(0); layerName = CatalogConfiguration.removeWorkspacePrefix(layerName, catalog); return matcher.replaceFirst("rest/wmts/" + workspaceName + ":" + layerName); } }
private String getNoPrefixedNameIfVirtualService() { // let's see if this a virtual service request WorkspaceInfo localWorkspace = LocalWorkspace.get(); if (localWorkspace != null) { // yes this is a virtual service request so removing the workspace prefix return CatalogConfiguration.removeWorkspacePrefix(info.getName(), catalog); } // this a normal request so just returning the prefixed layer name return info.getName(); }
layerName = CatalogConfiguration.removeWorkspacePrefix(layerName, catalog); layerName = localWorkspace.getName() + ":" + layerName;