public class UriPattern extends Object
| Modifier and Type | Field and Description |
|---|---|
static Comparator<UriPattern> |
URIPATTERN_COMPARATOR
Sort the templates according to the string comparison of the template regular expressions.
|
| Constructor and Description |
|---|
UriPattern(String template)
Constructs UriPattern.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
createUriWithValues(String schema,
String userInfo,
String host,
int port,
String path,
String query,
String fragment,
Map<String,?> values,
boolean encode)
Create URI from URI part.
|
static String |
createUriWithValues(String schema,
String userInfo,
String host,
int port,
String path,
String query,
String fragment,
Map<String,?> values,
boolean encode,
boolean asTemplate)
Create URI from URI part.
|
static String |
createUriWithValues(String schema,
String userInfo,
String host,
int port,
String path,
String query,
String fragment,
Object[] values,
boolean encode)
Create URI from URI part.
|
static String |
createUriWithValues(String schema,
String userInfo,
String host,
int port,
String path,
String query,
String fragment,
Object[] values,
boolean encode,
boolean asTemplate)
Create URI from URI part.
|
boolean |
equals(Object obj) |
int |
getNumberOfLiteralCharacters()
Get the number of literal characters in the template.
|
List<String> |
getParameterNames() |
Pattern |
getPattern()
Get the regex pattern.
|
String |
getRegex()
Get the regular expression.
|
String |
getTemplate()
Get the URI template as a String.
|
int |
hashCode() |
boolean |
match(String uri,
List<String> parameters)
Check is URI string match to pattern.
|
String |
toString() |
public static final Comparator<UriPattern> URIPATTERN_COMPARATOR
JSR-311 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 and the number of matching groups as a secondary key"
public UriPattern(String template)
template - the source templatejavax.ws.rs.Path}public Pattern getPattern()
public String getTemplate()
public String getRegex()
public int getNumberOfLiteralCharacters()
public boolean match(String uri, List<String> parameters)
uri - the URI stringparameters - target listpublic static String createUriWithValues(String schema, String userInfo, String host, int port, String path, String query, String fragment, Map<String,?> values, boolean encode, boolean asTemplate)
schema - the schema URI partuserInfo - the user info URI parthost - the host name URI partport - the port number URI partpath - the path URI partquery - the query string URI partfragment - the fragment URI partvalues - the values which must be used instead templates parametersencode - if true then encode value before add it in URI, otherwise value must be validate to legal charactersasTemplate - if true ignore absence value for any URI parameterspublic static String createUriWithValues(String schema, String userInfo, String host, int port, String path, String query, String fragment, Map<String,?> values, boolean encode)
schema - the schema URI partuserInfo - the user info URI parthost - the host name URI partport - the port number URI partpath - the path URI partquery - the query string URI partfragment - the fragment URI partvalues - the values which must be used instead templates parametersencode - if true then encode value before add it in URI, otherwise value must be validate to legal characterspublic static String createUriWithValues(String schema, String userInfo, String host, int port, String path, String query, String fragment, Object[] values, boolean encode, boolean asTemplate)
schema - the schema URI partuserInfo - the user info URI parthost - the host name URI partport - the port number URI partpath - the path URI partquery - the query string URI partfragment - the fragment URI partvalues - the values which must be used instead templates parametersencode - if true then encode value before add it in URI, otherwise value must be validate to legal charactersasTemplate - if true ignore absence value for any URI parameterspublic static String createUriWithValues(String schema, String userInfo, String host, int port, String path, String query, String fragment, Object[] values, boolean encode)
schema - the schema URI partuserInfo - the user info URI parthost - the host name URI partport - the port number URI partpath - the path URI partquery - the query string URI partfragment - the fragment URI partvalues - the values which must be used instead templates parametersencode - if true then encode value before add it in URI, otherwise value must be validate to legal charactersCopyright © 2012–2016 Codenvy, S.A.. All rights reserved.