NO MORE CAREER
POLITICIANS!
Get Out Of Our House: Replacing congress with TRUE citizens!
Contact Doug!
Learn About Doug!
View Doug Boude's online resume
updated 11/18/2009

View Doug Boude's profile on LinkedIn
Link to me!

Follow Doug Boude on Twitter
Follow me!

Be Doug's friend on Facebook
Befriend me!
(I promise not to follow you home)
OO Lexicon
Chat with Doug!
Recent Entries
You may also be interested in...
Web Hosting

best web hosting - top web hosting sites, thetop10bestwebhosting.com

Czech your Page Rank!
Check Page Rank of any web site pages instantly:
This free page rank checking tool is powered by Page Rank Checker service
Surf's Up!
Visit Egosurf.org and massage YOUR web ego!
My Score: 9,001
Doug's Books

Read (and recommend)

  • Men are from Mars, Women are from Venus
  • The Wisdom of Crowds: Why the Many Are Smarter Than the Few and How Collective Wisdom Shapes Business, Economies, Societies and Nations
  • Blink: The Power of Thinking Without Thinking
  • Head First Design Patterns
  • Transact-SQL Programming
  • What's So Amazing About Grace?
  • Just So Stories (Rudyard Kipling collection)

Reading

  • Prayer: Does it Make Any Difference?
  • Data Mining (Practical Machine Learning Tools and Techniques)
<< August, 2008 >>
SMTWTFS
12
3456789
10111213141516
17181920212223
24252627282930
31
Search Blog

Recent Comments
Re: Railo 3.1 on Windows Server 2008 and IIS7 - Part 3 of 3 (by Jon at 8/27 2:04 PM)
Re: Hosts File Changes Not Acknowledged on Vista 64 (by Spacy at 8/24 3:46 PM)
Re: THE DAY CFUNITED DIED (by ComboFusion at 8/23 10:50 AM)
Re: My Grandpa (by Tasha at 8/10 4:29 PM)
Re: Just What IS a 'Service Layer', Anyway? (by dougboude at 8/02 10:10 AM)
Re: Just What IS a 'Service Layer', Anyway? (by Isaac at 8/02 2:25 AM)
Re: PayPal IPN Coldfusion CFC (by Soyestudiambre at 7/25 6:12 PM)
Re: PHP vs COLDFUSION (by Tony Garcia at 7/17 11:24 AM)
Re: PHP vs COLDFUSION (by dougboude at 7/14 8:45 AM)
Re: PHP vs COLDFUSION (by Lola LB at 7/14 5:51 AM)
Categories
Archives
Photo Albums
Funnies (5)
Family (3)
RSS

Powered by
BlogCFM v1.11

16 June 2006
Managing ColdFusion Mappings through the BACK DOOR
Often when hosting a site somewhere, it can be a slow process to get a mapping created or modified. Then there are also those times when all you really need to be able to do is SEE them so you can verify paths and what not.

Using snippets harvested from google, I wrote myself a simple little MappingUtil.cfm page that I use to perform the tasks previously mentioned, and now i share it here with those who may be interested.

WARNING:
A few things you should think about before using this tool:
  1. This code uses undocumented methods and is not supported by Adobe. It is not guaranteed to work against every version of ColdFusion server.
  2. Most of the time, yours isn't the only site living on a particular host server. This tool will allow you to see and manage ALL mappings, whether yours or not, therefore you must be very careful not to delete someone else's mapping.
  3. Performing your own back door mapping management without the admin's knowledge could get you kicked off of your current host.
  4. Never drink and manage mappings at the same time.

Okay, cautions out of the way, below is the code. It should be saved in a template name that matches the form action. Currently that is "mappingutil.cfm". If you wish to save it as a different name, be sure to edit the form action as well.


********************************  The Code  ***********************************************************
<cfparam name="url.action" default="false">
<cfparam name="form.mapping" default="">
<cfset factory=createObject("java","coldfusion.server.ServiceFactory")>
<cfset mappings = factory.runtimeService.getMappings()>
<cfset actionmessage = "">
<cfif url.action>
    <cfif form.mapping IS NOT "">
        <cfloop index="m" list="#form.mapping#">
            <cfset tmp= structdelete(mappings,m)>
        </cfloop>
        <cfset actionmessage = "<h3>Items Deleted.</h3>">
    </cfif>
    <cfif form.mapname IS NOT "" and form.mappath IS NOT "">
        <cfset mappings[form.mapname] = form.mappath>
        <cfset actionmessage = actionmessage & "<h3>Mapping added.</h3>">
    </cfif>
</cfif>

<cfoutput>
#actionmessage#
<h2>Mapping Admin</h2>
<form action="mappingutil.cfm?action=true" method="post">
<table cellpadding="5" cellspacing="5" bgcolor="##FFFFFF">
<tr><th>Delete</th><th colspan="2" align="center">Mapping</th></tr>
<cfloop collection="#mappings#" item="thismapping">
<tr>
    <td>
        <input type="checkbox" name="mapping" value="#thismapping#">
    </td>
    <td>
         <strong>#thismapping#</strong>
     </td>
     <td>
         (#mappings[thismapping]#)
     </td>
</tr>
</cfloop>
<tr><td colspan="3">Enter new mapping: name<input type="text" value="" name="mapname" size="15">&nbsp;&nbsp;path<input type="text" name="mappath" value="#expandpath(".")#" size="45"></td></tr>
<tr><td colspan="3" align="center"><input type="submit" value="Save Changes"></td></tr>
</table>
</form>
</cfoutput>



Posted by dougboude at 12:00 AM | PRINT THIS POST! |Link | 2 comments
Subscription Options

You are not logged in, so your subscription status for this entry is unknown. You can login or register here.

Re: Managing ColdFusion Mappings through the BACK DOOR
Nice work Doug. Just one small pointer, the action "mappingutil.cfm?action=true" should probably say "#cgi.script_name#?action=true" instead so I can name the file whatever I want.
Posted by Boyan on September 21, 2007 at 4:20 PM

Re: Managing ColdFusion Mappings through the BACK DOOR
man this worked. had no problems running this on a CF8 local developer and standard server versions. wow!
Posted by scott welker on February 27, 2009 at 2:40 PM

Name:   Required
Email:   Required your email address will not be publicly displayed.

Want to receive notifications when new comments are added? Login/Register for an account.

Time to take the Turing Test!!!

16 plus 14 equals
Type in the answer to the question you see above:

Your comment:

Sorry, no HTML allowed!