CFLib.org – Common Function Library Project

enableDisableWhiteSpaceManagement([action])

Last updated February 14, 2004

Version: 1 | Requires: ColdFusion MX | Library: UtilityLib

 
Rated 0 time(s). Average Rating: 0

Description:
This function will enable or disable whitespace management in ColdFusion Server without access to ColdFusion Administrator. It returns the current status of the setting.

Return Values:
Returns a boolean.

Example:

view plain print about
<cfoutput>#enableDisableWhiteSpaceManagement("disable")#</cfoutput>

Parameters:

Name Description Required
action Either disable or enable. Defaults to enable. No

Full UDF Source:

view plain print about
<!---
 This function will enable or disable whitespace management in ColdFusion Server without access to ColdFusion Administrator.
 
 @param action      Either disable or enable. Defaults to enable. (Optional)
 @return Returns a boolean. 
 @author Qasim Rasheed (qasim_1976@yahoo.com) 
 @version 1, February 14, 2004 
--->

<cffunction name="enableDisableWhiteSpaceManagement" output="false" returntype="boolean">
    <cfargument name="action" type="string" default="enable" />
    <cfscript>
        var factory = CreateObject("Java","coldfusion.server.ServiceFactory");
        var runtime = "";
        
    
</cfscript>
    <cflock name="factory_runtimeservice" type="exclusive" timeout="5">
        <cfset runtime = factory.getRuntimeService()>
        <cfswitch expression="#arguments.action#">
            <cfcase value="enable">
                <cfif not runtime.WhiteSpace>
                    <cfset runtime.setWhiteSpace("YES")>
                </cfif>
            </cfcase>
            <cfcase value="disable">
                <cfif runtime.WhiteSpace>
                    <cfset runtime.setWhiteSpace("NO")>
                </cfif>
            </cfcase>
        </cfswitch>
    </cflock>
    <cfreturn runtime.WhiteSpace />
</cffunction>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Dave Anderson Dave Anderson added
iniToStruct
20 day(s) ago

Dave Anderson Dave Anderson added
deDupeArray
20 day(s) ago

Richard Richard added
dice
22 day(s) ago

Isaac Dealey Isaac Dealey added
getRelative
a while ago

Top Rated

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 22 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Raymond Camden highlightAndCrop
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson