public class DefaultMcpUriTemplateManager extends Object implements McpUriTemplateManager
This class provides methods for extracting variables from URI templates and matching them against actual URIs.
| Constructor and Description |
|---|
DefaultMcpUriTemplateManager(String uriTemplate)
Constructor for DefaultMcpUriTemplateManager.
|
| Modifier and Type | Method and Description |
|---|---|
Map<String,String> |
extractVariableValues(String requestUri)
Extract URI variable values from the actual request URI.
|
List<String> |
getVariableNames()
Extract URI variable names from a URI template.
|
boolean |
isUriTemplate(String uri)
Check if the given URI is a URI template.
|
boolean |
matches(String uri)
Check if a URI matches the uriTemplate with variables.
|
public DefaultMcpUriTemplateManager(String uriTemplate)
uriTemplate - The URI template to be used for variable extractionpublic List<String> getVariableNames()
getVariableNames in interface McpUriTemplateManagerIllegalArgumentException - if duplicate variable names are foundpublic Map<String,String> extractVariableValues(String requestUri)
This method converts the URI template into a regex pattern, then uses that pattern to extract variable values from the request URI.
extractVariableValues in interface McpUriTemplateManagerrequestUri - The actual URI from the requestIllegalArgumentException - if the URI template is invalid or the request URI
doesn't match the template patternpublic boolean matches(String uri)
matches in interface McpUriTemplateManageruri - The URI to checkpublic boolean isUriTemplate(String uri)
McpUriTemplateManagerisUriTemplate in interface McpUriTemplateManagerCopyright © 2025. All rights reserved.