Reputation: 79
Using Zuul, how do I extract the path variables (customerId
and agreementId
) given the following URL:
customers/{
customerId
}/agreements/{agreementId
}
Can I somehow get the reference names for the path variables using Zuul or Eureka or do I need to use RegEx or something similar?
Upvotes: 1
Views: 1706
Reputation: 1
I also have such a demand recently, I am studying how to solve this problem, you can refer to the AntPathMatcher
class in Spring Core
, maybe it will help you
Upvotes: 0
Reputation: 328
You can add a filter which will be used before your request actually goes to the controller.
You can extract path variables from HttpServletRequest like this:
Map<String, String> pathVariables = (Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
Upvotes: 0