Top Description Fields Constructors Methods
org.glassfish.tyrus.core.uri.internal

pack-priv Class UriParser

extends Object
Class Inheritance

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.
Authors
Paul Sandoz, Marek Potociar

Field Summary

Modifier and TypeField and Description
private String
private CharacterIterator
private static final String
private String
private String
private final String
private boolean
private boolean
private String
private String
private String
private String
private String
private String

Constructor Summary

AccessConstructor and Description
pack-priv
UriParser(String
String with URI to be parsed. May contain template parameters.
uri
)

Creates new parser initialized with uri.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

Authority.
getAuthority
()

Returns parsed authority component.

public String

Returns:

Fragment.
getFragment
()

Returns parsed fragment component.

public String

Returns:

Host.
getHost
()

Returns parsed host component.

public String

Returns:

Path.
getPath
()

Returns parsed path component.

public String

Returns:

Port.
getPort
()

Returns parsed port component.

public String

Returns:

Query.
getQuery
()

Returns parsed query component.

public String

Returns:

Scheme.
getScheme
()

Returns parsed scheme component.

public String

Returns:

Scheme specific part.
getSsp
()

Returns parsed scheme specific part.

public String

Returns:

User info.
getUserInfo
()

Returns parsed user info component.

public boolean

Returns:

True if the uri is opaque.
isOpaque
()

Returns whether the input string URI is opaque.

public void
parse()

Parses the input string URI.

private void
private String
parseComponent(String delimiters, boolean mayEnd)

private String

Returns:

Extracted component.
parseComponent
(String
String with delimiters which terminates the component.
delimiters
,
boolean
True if component might be the last part of the URI.
mayEnd
,
boolean
True if the component might contain IPv6 address.
isIp
)

Parses the URI component.

private String
parseComponentWithIP(String delimiters, boolean mayEnd)

private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

authorityback to summary
private String authority
ciback to summary
private CharacterIterator ci
ERROR_STATEback to summary
private static final String ERROR_STATE
fragmentback to summary
private String fragment
hostback to summary
private String host
inputback to summary
private final String input
opaqueback to summary
private boolean opaque
parserExecutedback to summary
private boolean parserExecuted
pathback to summary
private String path
portback to summary
private String port
queryback to summary
private String query
schemeback to summary
private String scheme
sspback to summary
private String ssp
userInfoback to summary
private String userInfo

Constructor Detail

UriParserback to summary
pack-priv UriParser(String uri)

Creates new parser initialized with uri.

Parameters
uri:String

String with URI to be parsed. May contain template parameters.

Method Detail

getAuthorityback to summary
public String getAuthority()

Returns parsed authority component. The method must be called before executing this method.

Returns:String

Authority.

getFragmentback to summary
public String getFragment()

Returns parsed fragment component. The method must be called before executing this method.

Returns:String

Fragment.

getHostback to summary
public String getHost()

Returns parsed host component. The method must be called before executing this method.

Returns:String

Host.

getPathback to summary
public String getPath()

Returns parsed path component. The method must be called before executing this method.

Returns:String

Path.

getPortback to summary
public String getPort()

Returns parsed port component. The method must be called before executing this method.

Returns:String

Port.

getQueryback to summary
public String getQuery()

Returns parsed query component. The method must be called before executing this method.

Returns:String

Query.

getSchemeback to summary
public String getScheme()

Returns parsed scheme component. The method must be called before executing this method.

Returns:String

Scheme.

getSspback to summary
public String getSsp()

Returns parsed scheme specific part. The method must be called before executing this method.

Returns:String

Scheme specific part.

getUserInfoback to summary
public String getUserInfo()

Returns parsed user info component. The method must be called before executing this method.

Returns:String

User info.

isOpaqueback to summary
public boolean isOpaque()

Returns whether the input string URI is opaque. The method must be called before executing this method.

Returns:boolean

True if the uri is opaque.

parseback to summary
public void parse()

Parses the input string URI. After calling this method The result components can be retrieved by calling appropriate getter methods like getHost(), getPort(), etc.

parseAuthorityback to summary
private void parseAuthority()
parseComponentback to summary
private String parseComponent(String delimiters, boolean mayEnd)
parseComponentback to summary
private String parseComponent(String delimiters, boolean mayEnd, boolean isIp)

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 the CharacterIterator.

Parameters
delimiters:String

String with delimiters which terminates the component.

mayEnd:boolean

True if component might be the last part of the URI.

isIp:boolean

True if the component might contain IPv6 address.

Returns:String

Extracted component.

parseComponentWithIPback to summary
private String parseComponentWithIP(String delimiters, boolean mayEnd)
parseHierarchicalUriback to summary
private void parseHierarchicalUri()
parsePathback to summary
private void parsePath()