Packagesystem
Classpublic class URI
InheritanceURI Inheritance Object

The "Uniform Resource Identifier" class.

note:

based on RFC 3986

examples of valid URIs :

     ftp://ftp.is.co.za/rfc/rfc1808.txt
     http://www.ietf.org/rfc/rfc2396.txt
     ldap://[2001:db8::7]/c=GB?objectClass?one
     mailto:John.Doe@example.com
     news:comp.infosystems.www.servers.unix
     tel:+1-816-555-1212
     telnet://192.0.2.16:80/
     urn:oasis:names:specification:docbook:dtd:xml:4.1.2
     



Public Properties
 PropertyDefined By
  authority : String
[read-only] Indicates the authority of the URI.
URI
  fragment : String
[read-only] Indicates the fragment expression of the URI.
URI
  greedy : Boolean
[static] Allows to alter the tring representation of the URI ex: for a raw URI "http://www.domain.com/path/file.html?" after parsing if greedy render as "http://www.domain.com/path/file.html" if not greedy render as "http://www.domain.com/path/file.html?"
URI
  host : String
Determinaes the host of the URI.
URI
  path : String
Determinates the path of the URI.
URI
  port : int
Determinates the port of the URI.
URI
  query : String
Determinates the encoded URI query, not including the ?.
URI
  scheme : String
Determinates the scheme of the URI.
URI
  source : String
[read-only] Original string source of the URI
URI
  strict : Boolean = true
[static] Allows to support deprecated behaviour or not ex: with userinfo if strict, we do not display the password if not strict we display the password
URI
  userinfo : String
[read-only] Indicates the user info expression of the URI.
URI
Public Methods
 MethodDefined By
  
URI(any:*, relativeURI:String)
Creates a new URI instance.
URI
  
getParameter(name:String):*
Returns the first value for a given cgi parameter or undefined if the given parameter name does not appear in the query string.
URI
  
Indicates the Map used in the URI to set the parameters of the query.
URI
  
hasFragment():Boolean
Indicates whether the fragment string has been set.
URI
  
hasParameter(name:String):Boolean
Indicates whether the specified parameter name exist in the query.
URI
  
hasQuery():Boolean
Indicates whether the query string has been set.
URI
  
isDomainAddress(str:String):Boolean
[static] Indicates if the uri is a domain address note: see: http://www.ietf.org/rfc/rfc1034.txt 3.5.
URI
  
isIPv4Address(str:String):Boolean
[static] syntax: IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255
URI
  
isUNC():Boolean
Indicates if the URI is UNC.
URI
  
isValidHost(str:String):Boolean
[static] Indicates if the specified host expression is valid (ipv4 or domain address).
URI
  
isValidPort(num:int):Boolean
[static] Indicates if the specified port is valid.
URI
  
isValidScheme(str:String):Boolean
[static] Indicates if the scheme of the uri is valid.
URI
  
Removes all the parameters in the query.
URI
  
removeParameter(name:String):void
Removes the named query parameter.
URI
  
setParameterValue(name:String, value:*):void
Sets the values of the named query parameters, clearing previous values for that key.
URI
  
toString():String
Returns the String representation of the object.
URI
  
valueOf():String
Returns the primitive value of the object.
URI
Property Detail
authorityproperty
authority:String  [read-only]

Indicates the authority of the URI. syntax:

authority = [ userinfo "@" ] host [ ":" port ]


Implementation
    public function get authority():String
fragmentproperty 
fragment:String  [read-only]

Indicates the fragment expression of the URI.


Implementation
    public function get fragment():String
greedyproperty 
public static var greedy:Boolean

Allows to alter the tring representation of the URI ex: for a raw URI "http://www.domain.com/path/file.html?" after parsing if greedy render as "http://www.domain.com/path/file.html" if not greedy render as "http://www.domain.com/path/file.html?"

hostproperty 
host:String

Determinaes the host of the URI.


Implementation
    public function get host():String
    public function set host(value:String):void
pathproperty 
path:String

Determinates the path of the URI.


Implementation
    public function get path():String
    public function set path(value:String):void
portproperty 
port:int

Determinates the port of the URI.


Implementation
    public function get port():int
    public function set port(value:int):void
queryproperty 
query:String

Determinates the encoded URI query, not including the ?. You can set a query with a string who not including the ? character, ex : "a=1&b=2".


Implementation
    public function get query():String
    public function set query(value:String):void
schemeproperty 
scheme:String

Determinates the scheme of the URI.


Implementation
    public function get scheme():String
    public function set scheme(value:String):void
sourceproperty 
source:String  [read-only]

Original string source of the URI


Implementation
    public function get source():String
strictproperty 
public static var strict:Boolean = true

Allows to support deprecated behaviour or not

ex: with userinfo

  • if strict, we do not display the password
  • if not strict we display the password
  • userinfoproperty 
    userinfo:String  [read-only]

    Indicates the user info expression of the URI.


    Implementation
        public function get userinfo():String
    Constructor Detail
    URI()Constructor
    public function URI(any:*, relativeURI:String)

    Creates a new URI instance.

    Parameters
    any:* — An URI object or a String expression to initialize the instance.
     
    relativeURI:String — The relative URI reference.
    Method Detail
    getParameter()method
    public function getParameter(name:String):*

    Returns the first value for a given cgi parameter or undefined if the given parameter name does not appear in the query string.

    Parameters

    name:String — The parameter to get values for.

    Returns
    * — the first value for a given cgi parameter or undefined if the given parameter name does not appear in the query string.
    getQueryMap()method 
    public function getQueryMap():Map

    Indicates the Map used in the URI to set the parameters of the query.

    Returns
    Map
    hasFragment()method 
    public function hasFragment():Boolean

    Indicates whether the fragment string has been set.

    Returns
    Boolean
    hasParameter()method 
    public function hasParameter(name:String):Boolean

    Indicates whether the specified parameter name exist in the query.

    Parameters

    name:String

    Returns
    Boolean
    hasQuery()method 
    public function hasQuery():Boolean

    Indicates whether the query string has been set.

    Returns
    Boolean
    isDomainAddress()method 
    public static function isDomainAddress(str:String):Boolean

    Indicates if the uri is a domain address

    note:

    see: http://www.ietf.org/rfc/rfc1034.txt

    3.5. Preferred name syntax

    [...]

    The following syntax will result in fewer problems with many applications that use domain names (e.g., mail, TELNET).

              <domain> ::= <subdomain> | " "
              
              <subdomain> ::= <label> | <subdomain> "." <label>
              
              <label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]
              
              <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
              
              <let-dig-hyp> ::= <let-dig> | "-"
              
              <let-dig> ::= <letter> | <digit>
              
              <letter> ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case
              
              <digit> ::= any one of the ten digits 0 through 9
              
              

    Note that while upper and lower case letters are allowed in domain names, no significance is attached to the case.That is, two names with the same spelling but different case are to be treated as if identical.

    The labels must follow the rules for ARPANET host names. They must start with a letter, end with a letter or digit, and have as interior characters only letters, digits, and hyphen. There are also some restrictions on the length. Labels must be 63 characters or less.

    Parameters

    str:String

    Returns
    Boolean
    isIPv4Address()method 
    public static function isIPv4Address(str:String):Boolean

    syntax: IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255

    Parameters

    str:String

    Returns
    Boolean
    isUNC()method 
    public function isUNC():Boolean

    Indicates if the URI is UNC.

    Returns
    Boolean
    isValidHost()method 
    public static function isValidHost(str:String):Boolean

    Indicates if the specified host expression is valid (ipv4 or domain address).

    Parameters

    str:String

    Returns
    Boolean
    isValidPort()method 
    public static function isValidPort(num:int):Boolean

    Indicates if the specified port is valid.

    Parameters

    num:int

    Returns
    Boolean
    isValidScheme()method 
    public static function isValidScheme(str:String):Boolean

    Indicates if the scheme of the uri is valid.

    RFC: 3.1. Scheme

    [...]

             Scheme names consist of a sequence of characters beginning with a 
             letter and followed by any combination of letters, digits, plus
             ("+"), period ("."), or hyphen ("-").  Although schemes are case-
             insensitive, the canonical form is lowercase and documents that
             specify schemes must do so with lowercase letters. An implementation
             should accept uppercase letters as equivalent to lowercase in scheme
             names (e.g., allow "HTTP" as well as "http") for the sake of
             robustness but should only produce lowercase scheme names for consistency.
             
    scheme = ALPHA  ALPHA / DIGIT / "+" / "-" / "." )

    Parameters

    str:String

    Returns
    Boolean
    removeAllParameters()method 
    public function removeAllParameters():void

    Removes all the parameters in the query.

    removeParameter()method 
    public function removeParameter(name:String):void

    Removes the named query parameter.

    Parameters

    name:String — The parameter to remove.

    setParameterValue()method 
    public function setParameterValue(name:String, value:*):void

    Sets the values of the named query parameters, clearing previous values for that key. Not new values will currently be moved to the end of the query string.

    Parameters

    name:String — The parameter to set.
     
    value:* — The new value.

    toString()method 
    public function toString():String

    Returns the String representation of the object.

    Returns
    String — the String representation of the object.
    valueOf()method 
    public function valueOf():String

    Returns the primitive value of the object.

    Returns
    String — the primivite value of the object.