@mozilla.org/network/standard-url;1

This component implements the following interfaces:

Constants

Blah:foo/bar => blah://foo/bar blah:/foo/bar => blah:///foo/bar blah://foo/bar => blah://foo/bar blah:///foo/bar => blah:///foo/bar
PRUint32 nsIStandardURL.URLTYPE_STANDARD = 1
Blah:foo/bar => blah://foo/bar blah:/foo/bar => blah://foo/bar blah://foo/bar => blah://foo/bar blah:///foo/bar => blah://foo/bar
PRUint32 nsIStandardURL.URLTYPE_AUTHORITY = 2
Blah:foo/bar => blah:///foo/bar blah:/foo/bar => blah:///foo/bar blah://foo/bar => blah://foo/bar blah:///foo/bar => blah:///foo/bar
PRUint32 nsIStandardURL.URLTYPE_NO_AUTHORITY = 3

Properties

readonly ACString nsIURI.asciiHost

The URI host with an ASCII compatible encoding. Follows the IDNA draft spec for converting internationalized domain names (UTF-8) to ASCII for compatibility with existing internet infrasture.

readonly ACString nsIURI.asciiSpec

The URI spec with an ASCII compatible encoding. Host portion follows the IDNA draft spec. Other parts are URL-escaped per the rules of RFC2396. The result is strictly ASCII.

AUTF8String nsIURL.directory

Returns the directory portion of a URL. If the URL denotes a path to a directory and not a file, e.g. http://foo/bar/, then the Directory attribute accesses the complete /foo/bar/ portion, and the FileName is the empty string. If the trailing slash is omitted, then the Directory is /foo/ and the file is bar (i.e. this is a syntactic, not a semantic breakdown of the Path). And hence dont rely on this for something to be a definitely be a file. But you can get just the leading directory portion for sure.

Some characters may be escaped.

AUTF8String nsIURL.fileBaseName

Returns the file basename portion of a filename in a url.

Some characters may be escaped.

AUTF8String nsIURL.fileExtension

Returns the file extension portion of a filename in a url. If a file extension does not exist, the empty string is returned.

Some characters may be escaped.

AUTF8String nsIURL.fileName

Returns the file name portion of a URL. If the URL denotes a path to a directory and not a file, e.g. http://foo/bar/, then the Directory attribute accesses the complete /foo/bar/ portion, and the FileName is the empty string. Note that this is purely based on searching for the last trailing slash. And hence dont rely on this to be a definite file.

Some characters may be escaped.

AUTF8String nsIURL.filePath

Returns a path including the directory and file portions of a URL. For example, the filePath of "http://foo/bar.html#baz" is "/foo/bar.html".

Some characters may be escaped.

AUTF8String nsIURI.host

The host is the internet domain name to which this URI refers. It could be an IPv4 (or IPv6) address literal. If supported, it could be a non-ASCII internationalized domain name.

Characters are NOT escaped.

AUTF8String nsIURI.hostPort

The host:port (or simply the host, if port == -1).

Characters are NOT escaped.

PRBool nsIStandardURL.mutable

Control whether or not this URL can be modified. Protocol handlers can set this flag before handing out an URL to ensure that it is not inadvertently modified.

readonly ACString nsIURI.originCharset

The charset of the document from which this URI originated. An empty value implies UTF-8.

If this value is something other than UTF-8 then the URI components (e.g., spec, prePath, username, etc.) will all be fully URL-escaped. Otherwise, the URI components may contain unescaped multibyte UTF-8 characters.

AUTF8String nsIURL.param

Returns the parameters specified after the ; in the URL.

Some characters may be escaped.

AUTF8String nsIURI.password

AUTF8String nsIURI.path

The path, typically including at least a leading '/' (but may also be empty, depending on the protocol).

Some characters may be escaped.

PRInt32 nsIURI.port

A port value of -1 corresponds to the protocol's default port (eg. -1 implies port 80 for http URIs).

readonly AUTF8String nsIURI.prePath

The prePath (eg. scheme://user:password@host:port) returns the string before the path. This is useful for authentication or managing sessions.

Some characters may be escaped.

AUTF8String nsIURL.query

Returns the query portion (the part after the "?") of the URL. If there isn't one, an empty string is returned.

Some characters may be escaped.

AUTF8String nsIURL.ref

Returns the reference portion (the part after the "#") of the URL. If there isn't one, an empty string is returned.

Some characters may be escaped.

ACString nsIURI.scheme

The Scheme is the protocol to which this URI refers. The scheme is restricted to the US-ASCII charset per RFC2396.

AUTF8String nsIURI.spec

Returns a string representation of the URI. Setting the spec causes the new spec to be parsed, initializing the URI.

Some characters may be escaped.

AUTF8String nsIURI.username

The optional username and password, assuming the preHost consists of username:password.

Some characters may be escaped.

AUTF8String nsIURI.userPass

The username:password (or username only if value doesn't contain a ':')

Some characters may be escaped.

Methods

InterfaceMethod
nsIURI nsIURI clone ( )
nsIURI PRBool equals ( nsIURI other )
nsIURL AUTF8String getCommonBaseSpec ( nsIURI URIToCompare )
nsIURL AUTF8String getRelativeSpec ( nsIURI URIToCompare )
nsIStandardURL void init ( PRUint32 urlType , PRInt32 defaultPort , AUTF8String spec , char* originCharset , nsIURI baseURI )
nsISerializable void read ( nsIObjectInputStream inputStream )
nsIURI AUTF8String resolve ( AUTF8String relativePath )
nsIURI PRBool schemeIs ( char* scheme )
nsISerializable void write ( nsIObjectOutputStream outputStream )

Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
No comments available

Copyright © 1999 - 2005 XULPlanet.com