Packagemx.utils
Classpublic class URLUtil
InheritanceURLUtil Inheritance Object

The URLUtil class is a static class with methods for working with full and relative URLs within Flex.



Public Properties
 PropertyDefined by
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Public Methods
 MethodDefined by
  
getFullURL(rootURL:String, url:String):String
[static] Converts a potentially relative URL to a full qualified URL.
URLUtil
  
[static]
URLUtil
  
[static]

Returns the protocol section of the specified url.

URLUtil
  
[static]
URLUtil
  
[static] Pull the domain and port information out of a URL.
URLUtil
 Inherited
Indicates whether an object has a specified property defined.
Object
  
[static]
URLUtil
  
[static] Determines if the URL starts with either http:, https:, or rtmp: followed by two slashes.
URLUtil
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
  
replacePort(uri:String, newPort:uint):String
[static] Returns a new string with the port replaced with the specified port.
URLUtil
  
replaceProtocol(uri:String, newProtocol:String):String
[static] This method will replace the protocol of the specified uri with the given protocol.
URLUtil
  
[static]
URLUtil
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Public Constants
 ConstantDefined by
  SERVER_NAME_TOKEN : String = "{server.name}"
[static]
URLUtil
  SERVER_PORT_TOKEN : String = "{server.port}"
[static]
URLUtil
Method detail
getFullURL()method
public static function getFullURL(rootURL:String, url:String):String

Converts a potentially relative URL to a full qualified URL. If the URL is not relative, it is just returned as is. If the URL starts with a slash, the host and port from the root URL are prepended. Otherwise, the host, port, and path are prepended.

Parameters
rootURL:String — URL used to resolve url, if url is relative.
 
url:String — URL to convert.

Returns
String — Fully qualified URL.
getPort()method 
public static function getPort(url:String):uintParameters
url:String

Returns
uint
getProtocol()method 
public static function getProtocol(url:String):String

Returns the protocol section of the specified url. Parameters

url:String — String containing the url to parse.

Returns
String — String containing the protocol or an empty string if no protocol is specified.

Example
getProtocol("https://localhost:2700/") returns "https" getProtocol("rtmp://www.myCompany.com/myMainDirectory/groupChatApp/HelpDesk") returns "rtmp" getProtocol("rtmpt:/sharedWhiteboardApp/June2002") returns "rtmpt" getProtocol("rtmp::1234/chatApp/room_name") returns "rtmp"

getServerName()method 
public static function getServerName(url:String):StringParameters
url:String

Returns
String
getServerNameWithPort()method 
public static function getServerNameWithPort(url:String):String

Pull the domain and port information out of a URL.

Parameters
url:String

Returns
String
isHttpsURL()method 
public static function isHttpsURL(url:String):BooleanParameters
url:String

Returns
Boolean
isHttpURL()method 
public static function isHttpURL(url:String):Boolean

Determines if the URL starts with either http:, https:, or rtmp: followed by two slashes.

Parameters
url:String

Returns
Booleantrue> if the URL starts with http:, https:, or rtmp: followed by two slashes.
replacePort()method 
public static function replacePort(uri:String, newPort:uint):String

Returns a new string with the port replaced with the specified port. If there is no port in the specified uri the port will be inserted. This method expects that a protocol has been specified within the uri.

Parameters
uri:String — String containing the uri in which the port should be replaced.
 
newPort:uint — uint containing the new port to subsitute.

Returns
String — String containing the uri with the port replaced.
replaceProtocol()method 
public static function replaceProtocol(uri:String, newProtocol:String):String

This method will replace the protocol of the specified uri with the given protocol.

Parameters
uri:String — String containing the uri in which the protocol needs to be replaced.
 
newProtocol:String — String containing the new protocol to use.

Returns
String — String containing the uri with the protocol replaced, or empty string if the uri doesn't contain a protocol.
replaceTokens()method 
public static function replaceTokens(url:String):StringParameters
url:String

Returns
String
Constant detail
SERVER_NAME_TOKENconstant
public static const SERVER_NAME_TOKEN:String = "{server.name}"
SERVER_PORT_TOKENconstant 
public static const SERVER_PORT_TOKEN:String = "{server.port}"




 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flex/2/langref/mx/utils/URLUtil.html