Class UriPart
java.lang.Object
org.glassfish.jersey.uri.internal.UriPart
This class represents a part of the uri as parsed by the UriTemplateParser.
The UriTemplate parser can produce multiple UriParts, each representing a part of the Uri. One part can represent either a static uri part without a template or a template with a single variable. The template with multiple variables generates multiple UriParts, each for a single variable.
-
Method Summary
Modifier and TypeMethodDescriptiongetGroup()
Return the matching group of the template represented by thisUriPart
getPart()
Return the string value representing this UriPart.boolean
Returns true when thisUriPart
is a template with a variablestatic String
percentEncode
(String toEncode, UriComponent.Type componentType, boolean encode) Percent encode the given textresolve
(Object value, UriComponent.Type componentType, boolean encode) Returns the resolved template variable when the value object is passedboolean
Informs whether throwIllegalArgumentException
when no object value matches the template argument
-
Method Details
-
getPart
Return the string value representing this UriPart. It can either be static content or a template.- Returns:
- string value representing this UriPart
-
getGroup
Return the matching group of the template represented by thisUriPart
- Returns:
- the matching group
-
isTemplate
public boolean isTemplate()Returns true when thisUriPart
is a template with a variable- Returns:
- true when a template
-
resolve
Returns the resolved template variable when the value object is passed- Parameters:
value
- the value object to be used to resolve the template variablecomponentType
- the component type that can be used to determine the encoding os special charactersencode
- the hint whether to encode or not- Returns:
- the resolved template
-
throwWhenNoTemplateArg
public boolean throwWhenNoTemplateArg()Informs whether throwIllegalArgumentException
when no object value matches the template argument- Returns:
true
when when no object value matches the template argument andIllegalArgumentException
is to be thrown
-
percentEncode
public static String percentEncode(String toEncode, UriComponent.Type componentType, boolean encode) Percent encode the given text- Parameters:
toEncode
- the given text to encodecomponentType
- the component type to encodeencode
- toEncode or contextualEncode- Returns:
- the encoded text
-