[英]How to the get wildcard path variable in the controller
我有一個 controller:
@PostMapping("/name/**")
public Mono<String> doSomething(HttpEntity<byte[]> requestEntity,
ServerHttpRequest serverHttpRequest) {
String restOfTheUrl = //the ** part is what i need here
return webClient.forwardRequest(requestEntity, serviceUrl + "/" + restOfTheUrl);
}
如何獲取/name/
之后的 URL 字符串(包括所有查詢參數)? 基本上我需要**
部分。 當然我可以從serverHttpRequest.getPath(..)
中刪除/name/
但是有更好的方法嗎?
@PostMapping("/name/{*path}")
public Mono<String> doSomething(@PathVariable("path") String path) {...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.