-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #579 from groldan/bug/gwc_rest_ambiguous_handler_m…
…ethod Resolve ambiguous handler mapping in SeedController
- Loading branch information
Showing
3 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/gwc/services/src/main/java/org/geoserver/cloud/gwc/config/services/SeedController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* (c) 2024 Open Source Geospatial Foundation - all rights reserved This code is licensed under the | ||
* GPL 2.0 license, available at the root application directory. | ||
*/ | ||
package org.geoserver.cloud.gwc.config.services; | ||
|
||
import java.io.InputStream; | ||
import java.util.Map; | ||
import javax.servlet.http.HttpServletRequest; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@Component | ||
@RestController | ||
@RequestMapping(path = "${gwc.context.suffix:}/rest") | ||
public class SeedController extends org.geowebcache.rest.controller.SeedController { | ||
|
||
/** | ||
* | ||
* {@inheritDoc} | ||
* <p> | ||
* Override for the {@code path} pattern to exclude {@code .xml} and | ||
* {@code .json} suffixes to avoid an exception like the following with | ||
* {@link #seedOrTruncateWithJsonPayload} and | ||
* {@link #seedOrTruncateWithXmlPayload}: | ||
* <pre> | ||
* <code> | ||
* java.lang.IllegalStateException: Ambiguous handler methods mapped for '.../rest/seed/workspace:layer.xml': { | ||
* public org.springframework.http.ResponseEntity org.geoserver.cloud.gwc.config.services.SeedController.seedOrTruncateWithXmlPayload(...), | ||
* public org.springframework.http.ResponseEntity org.geoserver.cloud.gwc.config.services.SeedController.doPost(...) | ||
* } | ||
* </code> | ||
* </pre> | ||
*/ | ||
@Override | ||
@PostMapping("/seed/{layer:^(?!.*\\.(?:xml|json)$).+}") | ||
public ResponseEntity<?> doPost( | ||
HttpServletRequest request, | ||
InputStream inputStream, | ||
@PathVariable String layer, | ||
@RequestParam Map<String, String> params) { | ||
|
||
return super.doPost(request, inputStream, layer, params); | ||
} | ||
} |