/// <summary>
        /// Returns the url for the composite file handler for the filePath specified.
        /// </summary>
        /// <param name="fileKey">The Base64 encoded file paths or the file map key used to lookup the required dependencies</param>
        /// <param name="type"></param>
        /// <param name="http"></param>
        /// <param name="urlType"></param>
        /// <param name="compositeFileHandlerPath"> </param>
        /// <param name="version"> </param>
        /// <returns></returns>
        public virtual string GetCompositeFileUrl(
            string fileKey,
            ClientDependencyType type,
            HttpContextBase http,
            CompositeUrlType urlType,
            string compositeFileHandlerPath,
            int version)
        {
            var url = new StringBuilder();

            switch (urlType)
            {
            case CompositeUrlType.Base64QueryStrings:

                //Create a URL with a base64 query string

                const string handler = "{0}?s={1}&t={2}";
                url.Append(string.Format(handler,
                                         compositeFileHandlerPath,
                                         http.Server.UrlEncode(fileKey), type));
                url.Append("&cdv=");
                url.Append(version.ToString());
                break;

            default:

                //Create a URL based on base64 paths instead of a query string

                url.Append(compositeFileHandlerPath);
                url.Append('/');

                //create the path based on the path format...
                var pathUrl = PathBasedUrlFormatter.CreatePath(PathBasedUrlFormat, fileKey, type, version);

                //append the path formatted
                url.Append(pathUrl);

                break;
            }

            return(url.ToString());
        }
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            base.Initialize(name, config);

            if (config == null)
            {
                return;
            }

            if (config["enableCssMinify"] != null)
            {
                bool enableCssMinify = true;
                if (bool.TryParse(config["enableCssMinify"], out enableCssMinify))
                {
                    EnableCssMinify = enableCssMinify;
                }
            }
            if (config["enableJsMinify"] != null)
            {
                bool enableJsMinify = true;
                if (bool.TryParse(config["enableJsMinify"], out enableJsMinify))
                {
                    EnableJsMinify = enableJsMinify;
                }
            }

            if (config["persistFiles"] != null)
            {
                bool persistFiles;
                if (bool.TryParse(config["persistFiles"], out persistFiles))
                {
                    PersistCompositeFiles = persistFiles;
                }
            }

            if (config["urlType"] != null)
            {
                try
                {
                    UrlType = (CompositeUrlType)Enum.Parse(typeof(CompositeUrlType), config["urlType"]);
                }
                catch (ArgumentException)
                {
                    //swallow exception, we've set the default
                }
            }
            if (config["pathUrlFormat"] != null)
            {
                PathBasedUrlFormat = config["pathUrlFormat"];
                PathBasedUrlFormatter.Validate(PathBasedUrlFormat);
            }

            CompositeFilePathAsString = config["compositeFilePath"] ?? DefaultDependencyPath;

            string bundleDomains = config["bundleDomains"];

            if (bundleDomains != null)
            {
                bundleDomains = bundleDomains.Trim();
            }
            if (string.IsNullOrEmpty(bundleDomains))
            {
                BundleDomains = new List <string>();
            }
            else
            {
                string[] domains = bundleDomains.Split(new char[] { ',' });
                for (int i = 0; i < domains.Length; i++)
                {
                    // make sure we have a starting dot and a trailing port
                    // ie 'maps.google.com' will be stored as '.maps.google.com:80'
                    if (domains[i].IndexOf(':') < 0)
                    {
                        domains[i] = domains[i] + ":80";
                    }
                    if (!domains[i].StartsWith("."))
                    {
                        domains[i] = "." + domains[i];
                    }
                }
                BundleDomains = new List <string>(domains);
            }
        }