我有一个控制器:
@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字符串(包括所有查询参数)?基本上,我需要**
部分。当然,我可以从/name/
中删除serverHttpRequest.getPath(..)
,但是有更好的方法吗?
答案 0 :(得分:2)
@PostMapping("/name/{*path}")
public Mono<String> doSomething(@PathVariable("path") String path) {...