Table of Contents

TUri Class

Parses a URI string into its components and exposes both the decoded and original (encoded) forms of the path, query, fragment, and segments.

Remarks

The parser handles the common scheme://[userinfo@]host[:port]/path?query#fragment form, including IPv6 host literals, and applies percent-decoding to produce the decoded properties. When no port is given, the default for the scheme (80 for http, 443 for https) is assumed. Implements IUri.

Syntax

Unit: Sparkle.Uri

TUri = class(TInterfacedObject, IUri);

Constructors

Name Description
Create Creates a URI by parsing the given URI string.

Methods

Name Description
Clone Creates a new TUri that is a copy of this one, parsed from the same original URI string.
HasScheme Indicates whether the given string begins with a URI scheme (for example http://).
ParseHost Overloaded
ParseHost(string, string, string)
ParseHost(string, string, Integer)
PercentDecode Percent-decodes a string. Deprecated.
PercentEncode Percent-encodes a string. Deprecated.

Properties

Name Description
AbsolutePath Gets the absolute path component of the URI, as originally received.
AbsoluteUri Gets the full absolute URI reconstructed from the parsed components.
Authority Gets the authority component, in the form [userinfo@]host[:port].
Fragment Gets the percent-decoded fragment component of the URI.
Host Gets the host component of the URI.
OriginalFragment Gets the fragment component exactly as received, without percent-decoding.
OriginalPath Gets the path component exactly as received, without percent-decoding.
OriginalQuery Gets the query component exactly as received, without percent-decoding.
OriginalSegments Gets the path segments as received, each still percent-encoded and retaining its trailing separator.
OriginalUri Gets the original URI string that was parsed to create this instance.
Path Gets the percent-decoded path component of the URI.
Port Gets the port number of the URI, resolved to the scheme default when not explicitly specified.
Query Gets the percent-decoded query component of the URI.
Scheme Gets the URI scheme, for example http, in lower case.
Segments Gets the percent-decoded path segments of the URI, with empty segments removed.
UserInfo Gets the user information component of the URI (the part before @ in the authority).