| Modifier and Type | Class and Description |
|---|---|
| private static interface | UriTemplate.
A strategy interface for processing parameters, should be replaced with a JDK 8 one day in the future. |
| Modifier and Type | Field and Description |
|---|---|
| public static final Comparator | COMPARATOR
Order the templates according to JAX-RS specification. |
| public static final UriTemplate | EMPTY
The empty URI template that matches the |
| private static final String[] | |
| private final boolean | endsWithSlash
True if the URI template ends in a '/' character. |
| private final String | normalizedTemplate
The normalized URI template. |
| private final int | numOfCharacters
The number of characters in the regular expression not resulting from conversion of template variables. |
| private final int | numOfExplicitRegexes
The number of explicit regular expressions declared for template variables. |
| private final int | numOfRegexGroups
The number of regular expression groups in this pattern. |
| private final PatternWithGroups | pattern
The pattern generated from the template. |
| private final String | template
The URI template. |
| private static final Pattern | TEMPLATE_NAMES_PATTERN
The regular expression for matching URI templates and names. |
| private final List | templateVariables
The template variables in the URI template. |
| Access | Constructor and Description |
|---|---|
| private | |
| public | |
| protected | UriTemplate(UriTemplateParser
the parser to parse the template. templateParser)Construct a new URI template. |
| Modifier and Type | Method and Description |
|---|---|
| public final String | |
| public final String | |
| public final String | Returns: the URI.the array of template values. The values will be
substituted in order of occurrence of unique template variables. values, final int the offset into the template value array. offset, final int the length of the template value array. length)Create a URI by substituting any template variables for corresponding template values. |
| public static String | Returns: a URI.the URI scheme component. scheme, String the URI authority component. authority, final String the URI user info component. userInfo, final String the URI host component. host, final String the URI port component. port, final String the URI path component. path, final String the URI query component. query, final String the URI fragment component. fragment, final Map<String, ?> the template variable to value map. values, final boolean if true encode a template value according to the correspond
component type of the associated template variable, otherwise
contextually encode the template value. encode, final boolean if encodeSlashInPath)true, the slash ('/') characters
in parameter values will be encoded if the template
is placed in the URI path component, otherwise the slash
characters will not be encoded in path templates.Construct a URI from the component parts each of which may contain template variables. |
| public static String | Returns: a URI.the URI scheme component. scheme, String the URI authority component. authority, final String the URI user info component. userInfo, final String the URI host component. host, final String the URI port component. port, final String the URI path component. path, final String the URI query component. query, final String ] the URI fragment component. fragment, final Object[] the array of template values. values, final boolean if true encode a template value according to the correspond
component type of the associated template variable, otherwise
contextually encode the template value. encode, final boolean if encodeSlashInPath)true, the slash ('/') characters
in parameter values will be encoded if the template
is placed in the URI path component, otherwise the slash
characters will not be encoded in path templates.Construct a URI from the component parts each of which may contain template variables. |
| private static int | createUriComponent(final UriComponent.
|
| public static String | Returns: a URI.the URI scheme component. scheme, final String the URI authority info component. authority, final String the URI user info component. userInfo, final String the URI host component. host, final String the URI port component. port, final String the URI path component. path, final String the URI query component. query, final String the URI fragment component. fragment, final Map<String, ?> the template variable to value map. values, final boolean if true encode a template value according to the correspond
component type of the associated template variable, otherwise
contextually encode the template value. encode, final boolean if encodeSlashInPath)true, the slash ('/') characters
in parameter values will be encoded if the template
is placed in the URI path component, otherwise the slash
characters will not be encoded in path templates.Construct a URI from the component parts each of which may contain template variables. |
| public static String | Returns: a URI.the URI scheme component. scheme, final String the URI authority component. authority, final String the URI user info component. userInfo, final String the URI host component. host, final String the URI port component. port, final String the URI path component. path, final String the URI query component. query, final String the URI fragment component. fragment, final String[] the array of template values. values, final boolean if true encode a template value according to the correspond
component type of the associated template variable, otherwise
contextually encode the template value. encode, final boolean if encodeSlashInPath)true, the slash ('/') characters
in parameter values will be encoded if the template
is placed in the URI path component, otherwise the slash
characters will not be encoded in path templates.Construct a URI from the component parts each of which may contain template variables. |
| private static String | createURIWithStringValues(final String scheme, final String authority, final String userInfo, final String host, final String port, final String path, final String query, final String fragment, final String[] values, final boolean encode, final boolean encodeSlashInPath, final Map<String, ?> mapValues)
|
| public final boolean | Returns: true if the template ends in a '/', otherwise false.Check if the URI template ends in a slash ( |
| public final boolean | Returns: true if equals, otherwise false.the reference object with which to compare. o)Overrides java. Equality is calculated from the String of the regular expression generated from the templates. |
| public final int | Returns: the number of explicit charactersGet the number of characters in the regular expression not resulting from conversion of template variables. |
| public final int | Returns: the number of explicit regular expressions in the template variables.Get the number of explicit regular expressions declared in the template variables. |
| public final int | Returns: the number of regular expressions groupsGet the number of regular expression groups |
| public final int | Returns: the number of template variables.Get the number of template variables. |
| public final PatternWithGroups | |
| public final String | |
| public final List | Returns: the list of template variables.Get the list of template variables for the template. |
| public final int | Returns: the hash code.Overrides java. Hash code is calculated from String of the regular expression generated from the template. |
| private static PatternWithGroups | Returns: the URI pattern.the URI template parser. templateParser)Create the URI pattern from a URI template parser. |
| public final boolean | Returns: true if the template variable is a member of the template, otherwise false.name The template variable. name)Ascertain if a template variable is a member of this template. |
| public final boolean | Returns: true if the URI matches the template, otherwise false.the uri to match against the template. uri, Map<String, String> the map where to put template variables (as keys)
and template values (as values). The map is cleared before any
entries are put. templateVariableToValue)Match a URI against the template. |
| public final boolean | Returns: true if the URI matches the template, otherwise false.the uri to match against the template. uri, List<String> the list to store the values of a pattern's
capturing groups is matching is successful. The values are stored
in the same order as the pattern's capturing groups. groupValues)Match a URI against the template. |
| public static URI | |
| public static URI | |
| private static boolean | |
| public static URI | Returns: relativized URI.base URI to be used for relativization. baseUri, URI URI to be relativized. refUri)Relativize URI with respect to a base URI. |
| public static URI | |
| public static URI | |
| private static void | resolveTemplate(String
normalized URI template. A normalized template is a template without any explicit
regular
expressions. normalizedTemplate, StringBuilder URI string builder to be used. builder, UriTemplate.The template value producer strategy to use. valueStrategyBuild a URI based on the parameters provided by the variable name strategy. |
| public static String | Returns: String with resolved template variables.Type of the type,template (port, path, query, ...).Input uri component to resolve. template, final boolean True if template values from encode, final Map<String, ?> _mapValues should be percent encoded.Map with template variables as keys and template values as values. None of them should be
null. _mapValues)Resolves template variables in the given |
| public final String |
| COMPARATOR | back to summary |
|---|---|
| public static final Comparator<UriTemplate> COMPARATOR Order the templates according to JAX-RS specification. Sort the set of matching resource classes using the number of characters in the regular expression not resulting from template variables as the primary key, the number of matching groups as a secondary key, and the number of explicit regular expression declarations as the tertiary key. | |
| EMPTY | back to summary |
|---|---|
| public static final UriTemplate EMPTY The empty URI template that matches the | |
| EMPTY_VALUES | back to summary |
|---|---|
| private static final String[] EMPTY_VALUES | |
| endsWithSlash | back to summary |
|---|---|
| private final boolean endsWithSlash True if the URI template ends in a '/' character. | |
| normalizedTemplate | back to summary |
|---|---|
| private final String normalizedTemplate The normalized URI template. Any explicit regex are removed to leave the template variables. | |
| numOfCharacters | back to summary |
|---|---|
| private final int numOfCharacters The number of characters in the regular expression not resulting from conversion of template variables. | |
| numOfExplicitRegexes | back to summary |
|---|---|
| private final int numOfExplicitRegexes The number of explicit regular expressions declared for template variables. | |
| numOfRegexGroups | back to summary |
|---|---|
| private final int numOfRegexGroups The number of regular expression groups in this pattern. | |
| pattern | back to summary |
|---|---|
| private final PatternWithGroups pattern The pattern generated from the template. | |
| template | back to summary |
|---|---|
| private final String template The URI template. | |
| TEMPLATE_NAMES_PATTERN | back to summary |
|---|---|
| private static final Pattern TEMPLATE_NAMES_PATTERN The regular expression for matching URI templates and names. | |
| templateVariables | back to summary |
|---|---|
| private final List<String> templateVariables The template variables in the URI template. | |
| UriTemplate | back to summary |
|---|---|
| private UriTemplate() Constructor for | |
| UriTemplate | back to summary |
|---|---|
| public UriTemplate(String template) throws PatternSyntaxException, IllegalArgumentException Construct a new URI template. The template will be parsed to extract template variables. A specific regular expression will be generated from the template to match URIs according to the template and map template variables to template values.
| |
| UriTemplate | back to summary |
|---|---|
| protected UriTemplate(UriTemplateParser templateParser) throws PatternSyntaxException, IllegalArgumentException Construct a new URI template. The template will be parsed to extract template variables. A specific regular expression will be generated from the template to match URIs according to the template and map template variables to template values.
| |
| createURI | back to summary |
|---|---|
| public final String createURI(final Map<String, String> values) Create a URI by substituting any template variables for corresponding template values. A URI template variable without a value will be substituted by the empty string. | |
| createURI | back to summary |
|---|---|
| public final String createURI(String... values) Create a URI by substituting any template variables for corresponding template values. A URI template variable without a value will be substituted by the empty string. | |
| createURI | back to summary |
|---|---|
| public final String createURI(final String[] values, final int offset, final int length) Create a URI by substituting any template variables for corresponding template values. A URI template variable without a value will be substituted by the empty string. | |
| createURI | back to summary |
|---|---|
| public static String createURI(final String scheme, String authority, final String userInfo, final String host, final String port, final String path, final String query, final String fragment, final Map<String, ?> values, final boolean encode, final boolean encodeSlashInPath) Construct a URI from the component parts each of which may contain template variables. A template values is an Object instance MUST support the toString() method to convert the template value to a String instance.
| |
| createURI | back to summary |
|---|---|
| public static String createURI(final String scheme, String authority, final String userInfo, final String host, final String port, final String path, final String query, final String fragment, final Object[] values, final boolean encode, final boolean encodeSlashInPath) Construct a URI from the component parts each of which may contain template variables. The template values are an array of Object and each Object instance MUST support the toString() method to convert the template value to a String instance.
| |
| createUriComponent | back to summary |
|---|---|
private static int createUriComponent(final UriComponent.
| |
| createURIWithStringValues | back to summary |
|---|---|
| public static String createURIWithStringValues(final String scheme, final String authority, final String userInfo, final String host, final String port, final String path, final String query, final String fragment, final Map<String, ?> values, final boolean encode, final boolean encodeSlashInPath) Construct a URI from the component parts each of which may contain template variables. A template value is an Object instance that MUST support the toString() method to convert the template value to a String instance.
| |
| createURIWithStringValues | back to summary |
|---|---|
| public static String createURIWithStringValues(final String scheme, final String authority, final String userInfo, final String host, final String port, final String path, final String query, final String fragment, final String[] values, final boolean encode, final boolean encodeSlashInPath) Construct a URI from the component parts each of which may contain template variables.
| |
| createURIWithStringValues | back to summary |
|---|---|
| private static String createURIWithStringValues(final String scheme, final String authority, final String userInfo, final String host, final String port, final String path, final String query, final String fragment, final String[] values, final boolean encode, final boolean encodeSlashInPath, final Map<String, ?> mapValues) | |
| endsWithSlash | back to summary |
|---|---|
| public final boolean endsWithSlash() Check if the URI template ends in a slash (
| |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Overrides java. Equality is calculated from the String of the regular expression generated from the templates. | |
| getNumberOfExplicitCharacters | back to summary |
|---|---|
| public final int getNumberOfExplicitCharacters() Get the number of characters in the regular expression not resulting from conversion of template variables.
| |
| getNumberOfExplicitRegexes | back to summary |
|---|---|
| public final int getNumberOfExplicitRegexes() Get the number of explicit regular expressions declared in the template variables.
| |
| getNumberOfRegexGroups | back to summary |
|---|---|
| public final int getNumberOfRegexGroups() Get the number of regular expression groups
| |
| getNumberOfTemplateVariables | back to summary |
|---|---|
| public final int getNumberOfTemplateVariables() Get the number of template variables.
| |
| getPattern | back to summary |
|---|---|
| public final PatternWithGroups getPattern() Get the URI pattern.
| |
| getTemplate | back to summary |
|---|---|
| public final String getTemplate() Get the URI template as a String.
| |
| getTemplateVariables | back to summary |
|---|---|
| public final List Get the list of template variables for the template. | |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Overrides java. Hash code is calculated from String of the regular expression generated from the template.
| |
| initUriPattern | back to summary |
|---|---|
| private static PatternWithGroups initUriPattern(UriTemplateParser templateParser) Create the URI pattern from a URI template parser.
| |
| isTemplateVariablePresent | back to summary |
|---|---|
| public final boolean isTemplateVariablePresent(String name) Ascertain if a template variable is a member of this template.
| |
| match | back to summary |
|---|---|
| public final boolean match(CharSequence uri, Map<String, String> templateVariableToValue) throws IllegalArgumentException Match a URI against the template. If the URI matches against the pattern then the template variable to value map will be filled with template variables as keys and template values as values.
| |
| match | back to summary |
|---|---|
| public final boolean match(CharSequence uri, List<String> groupValues) throws IllegalArgumentException Match a URI against the template. If the URI matches against the pattern the capturing group values (if any) will be added to a list passed in as parameter.
| |
| normalize | back to summary |
|---|---|
| public static URI normalize(final String uri) Normalize the URI by resolve the dot & dot-dot path segments as described in RFC 3986.
This method provides a workaround for issues with
| |
| normalize | back to summary |
|---|---|
| public static URI normalize(final URI uri) Normalize the URI by resolve the dot & dot-dot path segments as described in RFC 3986.
This method provides a workaround for issues with
| |
| notEmpty | back to summary |
|---|---|
| private static boolean notEmpty(String string) | |
| relativize | back to summary |
|---|---|
| public static URI relativize(URI baseUri, URI refUri) Relativize URI with respect to a base URI.
After the relativization is done, dots in paths of both URIs are | |
| resolve | back to summary |
|---|---|
| public static URI resolve(final URI baseUri, String refUri) Resolve a relative URI reference against a base URI as defined in RFC 3986.
| |
| resolve | back to summary |
|---|---|
| public static URI resolve(final URI baseUri, URI refUri) Resolve a relative URI reference against a base URI as defined in RFC 3986. | |
| resolveTemplate | back to summary |
|---|---|
| private static void resolveTemplate(String normalizedTemplate, StringBuilder builder, UriTemplate. Build a URI based on the parameters provided by the variable name strategy.
| |
| resolveTemplateValues | back to summary |
|---|---|
| public static String resolveTemplateValues(final UriComponent. Resolves template variables in the given
| |
| toString | back to summary |
|---|---|
| public final String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Modifier and Type | Method and Description |
|---|---|
| public String |
| valueFor | back to summary |
|---|---|
| public String valueFor(String templateVariable, String matchedGroup) Get a value for a given template variable.
| |