var authorizedFolders = ""; var file = ""; factory = CreateObject("java", "coldfusion.server.ServiceFactory"); runtime = factory.getRuntimeService(); security = factory.getSecurityService(); customTagRoots = runtime.getCustomtags(); mappings = runtime.getMappings() ; roots = ArrayNew(1) ; // add first all cf virtual directories in descendent order, this will // help preserve resolution precedence skipWebroot = false ; virtualDirs = StructKeyArray(mappings) ; ArraySort( virtualDirs, "TEXTNOCASE", "DESC" ) ; for ( i=1; i lte ArrayLen(virtualDirs); i=i+1 ) { prefix = NormalizePath( virtualDirs[i] ); prefix = Replace( prefix, '/', '.', 'ALL' ) ; if ( Find( '.', prefix ) eq 1 ) prefix = RemoveChars( prefix, 1, 1 ) ; if ( prefix eq '' and not skipWebroot ) skipWebroot = true ; root = StructNew() ; root.prefix = prefix ; root.physicalPath = NormalizePath( mappings[virtualDirs[i]] ) ; // for multiuser logins, check if the current user has access to folders if(security.isSandboxSecurityEnabled()) { if(hasAccessToFolder(root.physicalPath)) { ArrayAppend(roots, root); } } else { ArrayAppend(roots,root); } } // add webroot if ( not skipWebroot ) { temp = 'abcdefghijklmno.abcdefghijklmno' ; // temporary hack for IIS webroot = Replace(expandPath('/' & temp ), temp, '') ; root = StructNew() ; root.prefix = '' ; root.physicalPath = NormalizePath( webroot ) ; // for multiuser logins, check if the current user has access to folders if(security.isSandboxSecurityEnabled()) { if(hasAccessToFolder(root.physicalPath)) { ArrayAppend(roots, root); } } else { ArrayAppend(roots,root); } } // get custom tag roots installationRoot = Replace( server.coldfusion.rootdir, '\', '/', 'ALL' ) ; for ( ctRoot in customTagRoots ) { root = StructNew() ; root.prefix = '' ; // temporary workaround root.physicalPath = NormalizePath( Replace( CustomTagRoots[ctRoot], "##server.coldfusion.rootdir##", installationRoot ) ) ; // for multiuser logins, check if the current user has access to folders if(security.isSandboxSecurityEnabled()) { if(hasAccessToFolder(root.physicalPath)) { ArrayAppend(roots, root); } } else { ArrayAppend(roots,root); } } return roots ; var key = ""; factory = CreateObject("java", "coldfusion.server.ServiceFactory"); security = factory.getSecurityService(); if(security.isSandBoxSecurityEnabled()) { key = "getcfcs"&getCurrentUser(); } else { key = "getcfcs"; } readFromCache = checkCache(key) and not refreshCache ; if ( readFromCache ) { return getCache(key) ; } else { roots = getComponentRoots() ; components = StructNew() ; packages = StructNew() ; ignoreShadowedPackages = true ; for ( i=1; i lte ArrayLen( roots ); i=i+1 ) { root = CreateObject( "java", "java.io.File" ) ; root.init( roots[i].physicalPath ) ; browseForComponents( roots[i].prefix, root, roots[i].physicalPath, ignoreShadowedPackages ) ; // toggle the switch once we passed the web root (first root without // the package prefix if ( ignoreShadowedPackages and roots[i].prefix eq '' ) ignoreShadowedPackages = false ; } result = ArrayNew(1) ; for ( name in components ) { ArrayAppend( result, components[name] ) ; } setCache(key, result) ; return result ; } if ( IsDefined('arguments.path') and arguments.path neq '' ) { resourcescanonicalpath = createObject("java","java.io.File").init(arguments.path).getCanonicalPath(); var indexOfCFC = FindNoCase("cfc.",reverse(resourcescanonicalpath)); // "cfc." = reverse(".cfc") if (indexOfCFC neq 1) { //if path is not a cfc we throw error. Throw(type="Invalid Data", message="Unsupported file type. Check usage for Component Browser."); } // we are trimming the extension if provided with path. because of // 76373. We want to use GetComponentMetadata method as it gives advantage // over GetMetadata, in terms of not initializing the object to get metadata. // but Flex builder request come to call this method directly which have .cfc appended in the path. var trimmedPath = HTMLEditFormat(arguments.path); var indexOfCFC = FindNoCase("cfc.",reverse(trimmedPath)); // "cfc." = reverse(".cfc") if (indexOfCFC eq 1) // trimmedPath ends with .cfc { trimmedPath = Left(trimmedPath, len(trimmedPath) - 4); // Remove .cfc } return getComponentMetaData(trimmedPath); } else if( isDefined('arguments.name') ) { //This name should be a fully qualified name. return getComponentMetaData(HTMLEditFormat(name)); }

Component not found

The component definition file for component '#HTMLEditFormat(name)#' cannot be found on this server.
comp = CreateObject( "component", name ) ; utils = CreateObject( "component", "utils" ) ; return utils.cfcToMCDL(comp) ; proxy = CreateObject( "java", "coldfusion.runtime.TemplateProxyFactory" ) ; if ( IsDefined('arguments.path') and arguments.path neq '' ) { resourcescanonicalpath = createObject("java","java.io.File").init(arguments.path).getCanonicalPath(); var indexOfCFC = FindNoCase("cfc.",reverse(resourcescanonicalpath)); // "cfc." = reverse(".cfc") if (indexOfCFC neq 1) { //if path is not a cfc we throw error. Throw(type="Invalid Data", message="Unsupported file type. Check usage for Component Browser."); } comp = proxy.ResolvePath( HTMLEditFormat(arguments.path), getPageContext() ) ; } else { comp = proxy.resolveName(HTMLEditFormat(name),getPageContext()); } proxy.verifyInterfaceImplementation(comp,getPageContext()); utils = CreateObject( "component", "utils" ) ; WriteOutput( utils.cfcToHTML(comp) ) ;

Component not found

The component definition file for component '#HTMLEditFormat(name)#' cannot be found on this server.
tree = StructNew() ; cfcs = getcfcs(refreshCache) ; roots = getcomponentroots() ; for ( i=1; i lte ArrayLen(roots); i=i+1 ) { tree[roots[i].physicalPath] = StructNew() ; } for ( i=1; i lte ArrayLen(cfcs); i=i+1 ) { cfc = cfcs[i] ; if ( StructKeyExists( tree, cfc.cfcroot ) ) { if ( not StructKeyExists( tree[cfc.cfcroot], cfc.package ) ) { // add new package to the package struct tree[cfc.cfcroot][cfc.package] = ArrayNew(1) ; } ArrayAppend( tree[cfc.cfcroot][cfc.package], ListLast( cfc.name, '.' ) ) ; } } return tree ; cfcs = getcfcs(true) ; for ( i=1; i lte ArrayLen(cfcs); i=i+1 ) { if ( cfcs[i].name eq name ) return true ; } return false ;