Is there a way to get the registered URL pattern (In Controller) from the incoming HTTP request.
For Example, If my controller code is
@RestController
@RequestMapping("greeting")
public class Greeting {
@GetMapping("/{text}")
public String echo(@PathVariable("text") String text) {
return text;
}
}
Incoming request is http://localhost:8080/greeting/Hello, I want to get the mapping value /greeting/{text}. Can I achieve the same using any Interceptor or Handler?
I have registered all the original mapping URLs like /greeting/{text}, /users/find/{id} etc., and want to perform some validation if the incoming request falls into any of those registered requests. I could have achieve the same using one custom method level annotation but I don't want to change all the codes now. It would be nice if I can achieve the same from a single Interceptor or extending any spring handlers.
The above snippet is a sample one. I have 4 to 5 spring applications with different apis and want create a common security package which can achieve the same.