Packagegecko
Classpublic class nsIURI
InheritancensIURI Inheritance Object

nsIURI is an interface for an uniform resource identifier with internationalization support, offering attributes that allow setting and querying the basic components of a URI, and methods for performing basic operations on URIs.



Public Properties
 PropertyDefined By
   asciiHost : DOMString
[read-only] The URI host with an ASCII compatible encoding.
nsIURI
   asciiSpec : DOMString
[read-only] The URI spec with an ASCII compatible encoding.
nsIURI
   host : DOMString
The host is the Internet domain name to which this URI refers.
nsIURI
   hostPort : DOMString
The "host : port" part of the URI (or simply the host, if port is -1).
nsIURI
   originCharset : DOMString
[read-only] The charset of the document from which this URI originated.
nsIURI
   password : DOMString
The optional password, assuming the preHost consists of "username:password".
nsIURI
   path : DOMString
The path, typically including at least a leading '/' (but may also be empty, depending on the protocol).
nsIURI
   port : Number
The URI's port.
nsIURI
   prePath : DOMString
[read-only] The prePath returns the string before the path (such as "scheme://user:password
nsIURI
   scheme : DOMString
The scheme is the protocol to which this URI refers.
nsIURI
   spec : DOMString
Returns a string representation of the URI.
nsIURI
   username : DOMString
The optional username, assuming the preHost consists of "username:password".
nsIURI
   userPass : DOMString
The "username:password" (or username only if the value doesn't contain a ':').
nsIURI
Public Methods
 MethodDefined By
  
Clones the URI, returning a new nsIURI object.
nsIURI
  
 equals(other:DOMString):Boolean
Compares the current URI with another URI, returning true if the two represent the same location.
nsIURI
  
 resolve(relativePath:DOMString):DOMString
Resolves a relative URI string, using this URI as the base.
nsIURI
  
 schemeIs(scheme:DOMString):Boolean
Quickly reports whether the nsIURI represents a URI with the specified scheme.
nsIURI
Property Detail
asciiHostproperty
asciiHost:DOMString  [read-only]

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.


Implementation
    public function get asciiHost():DOMString
asciiSpecproperty 
asciiSpec:DOMString  [read-only]

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


Implementation
    public function get asciiSpec():DOMString
hostproperty 
host:DOMString

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. Note: Characters are not escaped.


Implementation
    public function get host():DOMString
    public function set host(value:DOMString):void
hostPortproperty 
hostPort:DOMString

The "host : port" part of the URI (or simply the host, if port is -1). Note: Characters are not escaped.


Implementation
    public function get hostPort():DOMString
    public function set hostPort(value:DOMString):void
originCharsetproperty 
originCharset:DOMString  [read-only]

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.) are all fully URL-escaped. Otherwise, the URI components may contain unescaped multibyte UTF-8 characters.


Implementation
    public function get originCharset():DOMString
passwordproperty 
password:DOMString

The optional password, assuming the preHost consists of "username:password". Note: Some characters may be escaped.


Implementation
    public function get password():DOMString
    public function set password(value:DOMString):void
pathproperty 
path:DOMString

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


Implementation
    public function get path():DOMString
    public function set path(value:DOMString):void
portproperty 
port:Number

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


Implementation
    public function get port():Number
    public function set port(value:Number):void
prePathproperty 
prePath:DOMString  [read-only]

The prePath returns the string before the path (such as "scheme://user:password


Implementation
    public function get prePath():DOMString
schemeproperty 
scheme:DOMString

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


Implementation
    public function get scheme():DOMString
    public function set scheme(value:DOMString):void
specproperty 
spec:DOMString

Returns a string representation of the URI. Setting the spec causes the new spec to be parsed using the rules for the scheme the URI currently has. If the string cannot be parsed as a URI, NS_ERROR_MALFORMED_URI thrown. If the URI stores information from the nsIIOService interface's newURI() call that created it, other than just the parsed string, the behavior of this information when setting the spec attribute is undefined.


Implementation
    public function get spec():DOMString
    public function set spec(value:DOMString):void
usernameproperty 
username:DOMString

The optional username, assuming the preHost consists of "username:password". Note: Some characters may be escaped.


Implementation
    public function get username():DOMString
    public function set username(value:DOMString):void
userPassproperty 
userPass:DOMString

The "username:password" (or username only if the value doesn't contain a ':'). Note: Some characters may be escaped.


Implementation
    public function get userPass():DOMString
    public function set userPass(value:DOMString):void
Method Detail
clone()method
public function clone():nsIURI

Clones the URI, returning a new nsIURI object.

Returns
nsIURI — An nsIURI object that represents the same URI as the current nsIURI.
equals()method 
public function equals(other:DOMString):Boolean

Compares the current URI with another URI, returning true if the two represent the same location. Note: This is more than a string comparison, as two different URI strings can represent the same location. For example, comparing "http://foo.com:80/" and "http://foo.com/" will return true.

Parameters

other:DOMString — Another nsIURI to compare to.

Returns
Boolean — If the two URIs represent the same location
resolve()method 
public function resolve(relativePath:DOMString):DOMString

Resolves a relative URI string, using this URI as the base.

Parameters

relativePath:DOMString — The relative path to resolve.

Returns
DOMString — The resolved absolute URI string.
schemeIs()method 
public function schemeIs(scheme:DOMString):Boolean

Quickly reports whether the nsIURI represents a URI with the specified scheme. This comparison is case-insensitive. Note: This is an optimization, allowing you to check the scheme of the URI without having to get the scheme and do the comparison yourself; this saves memory allocations.

Parameters

scheme:DOMString — A string representing the scheme to compare to.

Returns
Boolean — If the URI is for the specified scheme