Class UriParser
java.lang.Object
org.glassfish.jersey.uri.internal.UriParser
Parser for string URI with template parameters which produces
URIs from Strings.
Example of parsed uri: "http://user@{host}:{port}/a/{path}?query=1#fragment".
The parser is not thread safe.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns parsed authority component.Returns parsed fragment component.getHost()Returns parsed host component.getPath()Returns parsed path component.getPort()Returns parsed port component.getQuery()Returns parsed query component.Returns parsed scheme component.getSsp()Returns parsed scheme specific part.Returns parsed user info component.booleanisOpaque()Returns whether the input string URI is opaque.voidparse()Parses the input string URI.private voidprivate StringparseComponent(String delimiters, boolean mayEnd) private StringparseComponent(String delimiters, boolean mayEnd, boolean isIp) Parses the URI component.private StringparseComponentWithIP(String delimiters, boolean mayEnd) private voidprivate void
-
Field Details
-
ERROR_STATE
-
input
-
ci
-
scheme
-
userInfo
-
host
-
port
-
query
-
path
-
fragment
-
ssp
-
authority
-
opaque
private boolean opaque -
parserExecuted
private boolean parserExecuted
-
-
Constructor Details
-
UriParser
UriParser(String uri) Creates new parser initialized withuri.- Parameters:
uri- String with URI to be parsed. May contain template parameters.
-
-
Method Details
-
parseComponentWithIP
-
parseComponent
-
parseComponent
Parses the URI component. Parsing starts at position of the first character of component and ends with position of one of the delimiters. The string and current position is taken from theCharacterIterator.- Parameters:
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.- Returns:
- Extracted component.
-
parse
public void parse() -
parseHierarchicalUri
private void parseHierarchicalUri() -
parseAuthority
private void parseAuthority() -
parsePath
private void parsePath() -
getSsp
Returns parsed scheme specific part. Themethodmust be called before executing this method.- Returns:
- Scheme specific part.
-
getScheme
Returns parsed scheme component. Themethodmust be called before executing this method.- Returns:
- Scheme.
-
getUserInfo
Returns parsed user info component. Themethodmust be called before executing this method.- Returns:
- User info.
-
getHost
Returns parsed host component. Themethodmust be called before executing this method.- Returns:
- Host.
-
getPort
Returns parsed port component. Themethodmust be called before executing this method.- Returns:
- Port.
-
getQuery
Returns parsed query component. Themethodmust be called before executing this method.- Returns:
- Query.
-
getPath
Returns parsed path component. Themethodmust be called before executing this method.- Returns:
- Path.
-
getFragment
Returns parsed fragment component. Themethodmust be called before executing this method.- Returns:
- Fragment.
-
getAuthority
Returns parsed authority component. Themethodmust be called before executing this method.- Returns:
- Authority.
-
isOpaque
public boolean isOpaque()Returns whether the input string URI is opaque. Themethodmust be called before executing this method.- Returns:
- True if the uri is opaque.
-