final class UriParser extends Object
java.net.URI URIs from Strings.
Example of parsed uri: "http://user@{host}:{port}/a/{path}?query=1#fragment".
The parser is not thread safe.| Modifier and Type | Field and Description |
|---|---|
private String |
authority |
private CharacterIterator |
ci |
private static String |
ERROR_STATE |
private String |
fragment |
private String |
host |
private String |
input |
private boolean |
opaque |
private boolean |
parserExecuted |
private String |
path |
private String |
port |
private String |
query |
private String |
scheme |
private String |
ssp |
private String |
userInfo |
| Constructor and Description |
|---|
UriParser(String uri)
Creates new parser initialized with
uri. |
| Modifier and Type | Method and Description |
|---|---|
String |
getAuthority()
Returns parsed authority component.
|
String |
getFragment()
Returns parsed fragment component.
|
String |
getHost()
Returns parsed host component.
|
String |
getPath()
Returns parsed path component.
|
String |
getPort()
Returns parsed port component.
|
String |
getQuery()
Returns parsed query component.
|
String |
getScheme()
Returns parsed scheme component.
|
String |
getSsp()
Returns parsed scheme specific part.
|
String |
getUserInfo()
Returns parsed user info component.
|
boolean |
isOpaque()
Returns whether the input string URI is opaque.
|
void |
parse()
Parses the input string URI.
|
private void |
parseAuthority() |
private String |
parseComponent(String delimiters,
boolean mayEnd) |
private String |
parseComponent(String delimiters,
boolean mayEnd,
boolean isIp)
Parses the URI component.
|
private String |
parseComponentWithIP(String delimiters,
boolean mayEnd) |
private void |
parseHierarchicalUri() |
private void |
parsePath() |
private static final String ERROR_STATE
private final String input
private CharacterIterator ci
private String scheme
private String userInfo
private String host
private String port
private String query
private String path
private String fragment
private String ssp
private String authority
private boolean opaque
private boolean parserExecuted
UriParser(String uri)
uri.uri - String with URI to be parsed. May contain template parameters.private String parseComponent(String delimiters, boolean mayEnd, boolean isIp)
org.glassfish.jersey.uri.internal.CharacterIterator.delimiters - String with delimiters which terminates the component.mayEnd - True if component might be the last part of the URI.isIp - True if the component might contain IPv6 address.public void parse()
#getHost(), #getPort(), etc.private void parseHierarchicalUri()
private void parseAuthority()
private void parsePath()
public String getSsp()
#parse() method must be called before executing this method.public String getScheme()
#parse() method must be called before executing this method.public String getUserInfo()
#parse() method must be called before executing this method.public String getHost()
#parse() method must be called before executing this method.public String getPort()
#parse() method must be called before executing this method.public String getQuery()
#parse() method must be called before executing this method.public String getPath()
#parse() method must be called before executing this method.public String getFragment()
#parse() method must be called before executing this method.public String getAuthority()
#parse() method must be called before executing this method.public boolean isOpaque()
#parse() method must be called before executing this method.Copyright © 2014 Sven Strittmatter. All Rights Reserved.