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.boolean
isOpaque()
Returns whether the input string URI is opaque.void
parse()
Parses the input string URI.private void
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
private 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. Themethod
must be called before executing this method.- Returns:
- Scheme specific part.
-
getScheme
Returns parsed scheme component. Themethod
must be called before executing this method.- Returns:
- Scheme.
-
getUserInfo
Returns parsed user info component. Themethod
must be called before executing this method.- Returns:
- User info.
-
getHost
Returns parsed host component. Themethod
must be called before executing this method.- Returns:
- Host.
-
getPort
Returns parsed port component. Themethod
must be called before executing this method.- Returns:
- Port.
-
getQuery
Returns parsed query component. Themethod
must be called before executing this method.- Returns:
- Query.
-
getPath
Returns parsed path component. Themethod
must be called before executing this method.- Returns:
- Path.
-
getFragment
Returns parsed fragment component. Themethod
must be called before executing this method.- Returns:
- Fragment.
-
getAuthority
Returns parsed authority component. Themethod
must be called before executing this method.- Returns:
- Authority.
-
isOpaque
public boolean isOpaque()Returns whether the input string URI is opaque. Themethod
must be called before executing this method.- Returns:
- True if the uri is opaque.
-