ColdFusion – get admin mappings

Written on 19 December 2011, 03:43pm

Tagged with:

Here is a very useful recipe from the Adobe Cookbooks: how to retrieve the mappings from the admin area.
It’s really simple, it involves using the coldfusion.server.ServiceFactory java class, but I am posting it here because I am sure that I will come back to this post at some point in the future 🙂

<cffunction name="getMappings" access="public" returntype="struct" output="false">
    <cfset var mappings = StructNew()>
    <cfset ServiceFactory = createObject("java","coldfusion.server.ServiceFactory")>
    <cfset mappings = ServiceFactory.runtimeService.getMappings()>
    <cfreturn mappings>

Et voila:

This is useful when you don’t have access to the CF Admin interface.

Remember that the CF Admin Mappings are for ColdFusion, while the virtual directories are for the web server!

Update, 02 March 2015: In case you have access to ColdFusion configuration files, the mappings can be found in plain text in the file neo-runtime.xml (link)

Leave a response