- 
                Notifications
    You must be signed in to change notification settings 
- Fork 38.8k
Description
Summary
This is an enhancement request to add uriTemplate parameter in the arguments of ClientHttpRequestFactory#createRequest.
Background
In RESTful principal, it is strongly recommended to include ID as a path parameter of the path of endpoint interacting with a specific resource e.g. /users/{userId}.
Thus, rather than the actual path like /users/john, the URI template needs to be checked to apply endpoint specific configuration inside ClientHttpRequestFactory#createRequest using underlying client library such as timeout or logging.
Problem
Currently the method has only two arguments, URI and HttpMethod.
Due to this, my ClientHttpRequestFactory implementation needs to look up per endpoint configuration by matching URI and URI templates while the given URI is created from the endpoint's URI template.
// load endpoint configs from the property file
// Actual implemention considers http method as well but I omitted it here as it is not related here.
var endpointConfigs = Map.of(uriTemplate, endpointConf).
endpointConfigs.entrySet()
    .stream()
    .filter((template, config) -> UriTemplate.matches(template, uri))
    .first()
    .ifPresent(_, config) -> config.apply(request)).Once uriTemplate is introduced the above code can be replaced with
var endpointConfigs = Map.of(uriTemplate, endpointConf).
endpointConfigs.get(uriTemplate).apply(request).