1  /**
     2   * com.sekati.net.NetBase
     3   * @version 1.0.1
     4   * @author jason m horwitz | sekati.com
     5   * Copyright (C) 2007  jason m horwitz, Sekat LLC. All Rights Reserved.
     6   * Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
     7   */
     8   
     9  import com.sekati.validate.StringValidation;
    10  
    11  /**
    12   * static class wrapping various Network utilities
    13   */
    14  class com.sekati.net.NetBase {
    15  
    16  	/**
    17  	 * return the URL Path swf is running under
    18  	 * @return String
    19  	 * {@code Usage:
    20  	 * 	// run from http://localhost/myProject/site.swf
    21  	 * 	trace(NetBase.getPath()); // returns "http://localhost/myProject/"
    22  	 * }
    23  	 */
    24  	public static function getPath():String {
    25  		return( _root._url.substr( 0, _root._url.lastIndexOf( "/" ) + 1 ) );
    26  	}
    27  
    28  	/**
    29  	 * check if we are online the swf is being executed over http.
    30  	 * @return Boolean
    31  	 */
    32  	public static function isOnline():Boolean {
    33  		return StringValidation.isURL( _root._url );
    34  	}
    35  
    36  	/**
    37  	 * add a cache killing querystring to url
    38  	 * @param url (String)
    39  	 * @return String
    40  	 * {@code Usage:
    41  	 * 	var ckUrl = NetBase.noCacheUrl("http://localhost/page.html"); // returns: http://localhost/page.html?030533
    42  	 * }
    43  	 */
    44  	public static function noCacheUrl(url:String):String {
    45  		return url + "?" + new Date( ).getTime( );	
    46  	}
    47  
    48  	private function NetBase() {	
    49  	}
    50  }