CFLib.org – Common Function Library Project

enableDisableWhiteSpaceManagement([action])

Last updated February 14, 2004

author

Qasim Rasheed

Version: 1 | Requires: CF6 | Library: UtilityLib

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:

<cfoutput>#enableDisableWhiteSpaceManagement("disable")#</cfoutput>

Parameters:

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

Full UDF Source:

<!---
 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>

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson