charon-spring-boot-starter
charon-spring-boot-starter copied to clipboard
Dynamic route request
currently, should setting the mapping rule on startup.
In some cases, I hope to dynamically forward in the controller according to the business situation
@GetMapping(value = "/route") ResponseEntity<?> route(@PathVariable String biz) { if (biz == '1') forwordTo("http://localhost:8091/biz")
else if (biz == "2") forwordTo("http://localhost:8090/biz") }
i have been tested restTemplate to route the request. but if the client does not pass the information according to the specification, this code will throw an exception, such as get request with requestbody.
the end uri is a GET method with requestbody, an exception message was raised.
I hope the code like this
Router.forward(request, url)
is any way here? thanks.