Indy 9
TIdURI
Hierarchy, Properties, Methods, See Also, Unit: IdURI
Represents a Universal Resource Identifier.
TIdURI = class
Unit
IdURI
Description
The TIdURI object parses a URI specified in the Create constructor into its components: Protocol, Host, Port, Path, Document, and Bookmark. You may also modify the URI using object properties.

TIdURI.Bookmark
TIdURI, See Also
Represents an Anchor specified in a URI.
property Bookmark: string;
Description
This is an anchor into a document which was specified by the URI. Most web-browsers will simply load the document and scroll down to were the anchor is located in the document. The anchor is used internally by web-browsers and is never sent to the server. TIdHTTP and TIdHTTPServer will ignore the anchor if it is provided.

TIdURI.Document
TIdURI
Represents the document name in a URI.
property Document: string;
Description
Document is a String property that represents the document portion of a URI. For example, the URI "http://www.nevrona.com:80/indy/index.html" would result in Document containing the value "index.html".

Document may be blank if a user is requesting a default page or URL such as "http://www.nevrona.com/indy/", a directory, or when documents are not applicable to the protocol.


TIdURI.Host
TIdURI
Represents the host name portion of a URI.
property Host: string;
Description
Host is a String property that represents the host name portion of a URI. For example, a URI with the value "http://www.nevrona.com:80/indy/index.html" would result in the Host property having the value "www.nevrona.com".

Host can contain either a computer name such as "www.nevrona.com" or an IP address such as "208.225.207.130".


TIdURI.Params
TIdURI, See Also
Represents optional arguments in the URI.
property Params: string;
Description
Params is a String property that represents optional arguments used in the URI. Params will normally contain values that do not represent one of the other URI component values like Document or Bookmark as extracted in ParseURI. Params values are normally expressed in the URN notation and can be encoded from their raw form using ParansEncode.

Params is updated in ParseURI, and is used when GetFullURI is called to rebuild the URI value from its components.


TIdURI.Password
TIdURI, See Also
Represents a password in a URI.
property Password: string;
Description
Password is a String property that represents a password that occurs in the URI expressed in the form:

      http://username:password@hostname:port/path/document#bookmark

TIdURI.Path
TIdURI
Represents the path for a URI.
property Path: string;
Description
Path is a String property that represents the path portion of a URI. For example, the URI with the value "http://www.nevrona.com:80/indy/index.html" would result in the Path property containing the value "/indy/".

Path can contain "/" if the root directory is specified, or when a path is not applicable with the protocol.


TIdURI.Port
TIdURI
Represents the port portion of a URI.
property Port: string;
Description
Port is a String property that represents the port specified in a URI. For example, a URI with the value "http://www.nevrona.com:80/indy/index.html" would result in Port property containing the value "80".

Often the Port property is not used because most URI's use a default port which is indicated by the protocol, as in "http://www.nevrona.com/indy/index.html". The HTTP protocol uses port 80 by default.

However, this value should be checked since port can be overridden by a port specified in the URI.


TIdURI.Protocol
TIdURI
Represents the protocol requested in a URI.
property Protocol: string;
Description
Protocol is a String property that represents the protocol requested in a URI. For example, a URI with the value "http://www.nevrona.com:80/indy/index.html" would result in the Protocol property containg the value "http".

TIdURI.URI
TIdURI
Represents a complete Universal Resource Identifier.
property URI: string;
Description
URI is a String property that represents the complete Protocol, Host, Port, Path, Document, and Bookmark for a resource. Changing the value of URI will cause Protocol, Host, Port, Path, Document, and Bookmark to be parsed from the URI into the corresponding property values.

TIdURI.Username
TIdURI, See Also
Represents a user name in a URI.
property Username: string;
Description
Username is a String property that represents the user name contained in a URI expressed in the form:

      http://username:password@hostname:port/path/document#bookmark

TIdURI.Create
TIdURI, See Also, Example
Constructor for the object instance.
constructor Create(const AURI: string = ''); virtual;
Parameters
const AURI: string = ''
Universal Resource Identifier represented by the object instance. Default value is ''.
Description
Create is the constructor for the object instance. Create calls the inherited Create method. AURI is an optional String that specifies the Protocol, Host, Port, Path, Document, and Bookmark for the resource. When AURI contains a non-blank value, the value is asdsigned to the URI property, and causes the component portions of the URI to be parsed into their corresponding object properties.

TIdURI.GetFullURI
TIdURI, See Also
Retrieves a URI value including optional fields.
function GetFullURI(const AOptionalFileds: TIdURIOptionalFieldsSet = [ofAuthInfo, ofBookmark]): String;
Parameters
const AOptionalFileds: TIdURIOptionalFieldsSet = [ofAuthInfo, ofBookmark]
Optional URI fields to include in the return value.
Return Value
String - URI constructed from property values.
Description
GetFullURI is a String function that constructs a URI from property values, and may include optional field values as indicated in AOptionalFileds. The return value for GetFullURI contains a string in the format:

    protocol://username:password@host:port/document#bookmark

Username and Password property values are included in the URI when Username is not blank and AOptionalFields includes the value ofAuthInfo.

Port number is included in the URI when the property contains a non-zero value.

The value for Bookmark is included in the URI when the property is not blank and AOptionalFields includes the value ofBookmark.

Use the URI property to get the URI value without optional URI fields.


TIdURI.NormalizePath
TIdURI
Converts a directory specifier to the UNIX format.
class procedure NormalizePath(var APath: string);
Parameters
var APath: string
Directory to be normalized.
Description
NormalizePath is a class procedure that converts the directory specified in APath to the UNIX directory syntax. NormalizePath will convert all "" characters to the UNIX path seperator "/". NormalizePath does NOT convert device names.

NormalizePath returns the converted path specifier in the APath parameter.


TIdURI.ParamsEncode
TIdURI, See Also
Converts URI parameter values to their encoded form.
class function ParamsEncode(const ASrc: string): string;
Parameters
const ASrc: string
Unencoded parameter values for the method.
Return Value
String - Parameter values with unsafe characters translated to their encoded values.
Description
ParamsEncode is a String function used to convert unsafe characters in the URI parameter values specified in ASrc to their encoded form. ParamsEncode will convert unsafe characters to their representation in the form %nn, when nn is a the ordinal value of the unsafe character expressed in hexadecimal form. Unsafe characters include any ordinal value greater than $79 (127 Decimal), and the following reserved characters:

  • *

  • #

  • %

  • <

  • >

  • +

ParamsEncode will also convert the space character (CHAR32) to it's encoded representation as the character '+' (43 Decimal) (2B Hex).

ParamEncode is a class method, and may be used with a class instance instead of an object instance. For example:

      sEncVal := TIdURI.ParamsEncode('gn=local group+uid=12');

TIdURI.PathEncode
TIdURI, See Also
Converts URI path values to their encoded form.
class function PathEncode(const ASrc: string): string;
Parameters
const ASrc: string
Unencoded parameter values for the method.
Return Value
String - Path value with unsafe characters translated to their encoded form.
Description
PathEncode is a String function used to convert unsafe characters in the URI path specified in ASrc to their encoded form. PathEncode will convert unsafe characters to their representation in the form %nn, when nn is a the ordinal value of the unsafe character expressed in hexadecimal form. Unsafe characters include any ordinal value greater than $79 (127 Decimal), and the following reserved characters:

  • *

  • #

  • %

  • <

  • >

  • +

  • (Space)

PathEncode is a class method, and may be used with a class instance instead of an object instance. For example:

      sEncVal := TIdURI.PathEncode('program filesborlanddelphi6');

TIdURI.URLDecode
TIdURI, See Also, Example
Converts a URL-Encoded string to a US-ASCII string.
class function URLDecode(ASrc: string): string;
Parameters
ASrc: string
URL-encoded string to be decoded.
Return Value
String - The un-encoded ASCII representation of the URL.
Description
URLDecode is a String class function that converts the URL-encoded string in ASrc to its representation in the US-ASCII character set. URLDecode is based on the URL character encoding rules as described in the Internet Standards document RFC 1738 - Uniform Resource Locators (URL) (http://www.rfc-editor.org/rfc/rfc1738.txt) .

URLDecode can used to reverse any string encoding performed using URLEncode.

URLDecode converts all occurrances of the '+' character to ' ' (Space) (Decimal 32). URLDecode reads any values represented as a hexadecimal character triplet consisting of the "%" character followed by the two-digit hexadecimal value for the octet, and returns the value to its US-ASCII representation.


TIdURI.URLEncode
TIdURI, See Also, Example
Converts a US-ASCII string to a URL-Encoded string.
class function URLEncode(const ASrc: string): string;
Parameters
const ASrc: string
US-ASCII string to be encoded.
Return Value
String - URL-encoded representation of the string.
Description
URLEncode is a String class function that converts a US-ASCII string to its representation in the URL Encoding scheme. URLEncode is based on the URL character encoding rules as described in the Internet Standards document RFC 1738 - Uniform Resource Locators (URL) (http://www.rfc-editor.org/rfc/rfc1738.txt)

URLEncode performs special handling for characters deemed unsafe in the URL encoding scheme, and any graphical US-ASCII characters in the range 80-FF hexadecimal. The characters are converted to the character triplet consisting of the "%" character followed by the two-digit hexadecimal value for the octet.

Use URLDecode to return a URL-encoded string to its US-ASCII representation.


Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.