Skip to main content
Participant
December 20, 2017
Question

How do I extend application.cfc

  • December 20, 2017
  • 1 reply
  • 1735 views

My current attempt at extending m application.cfc results in this message:

The folderA.subfolderB.///Application component or interface cannot extend itself.

 

 

I have a folder named "folderA" and within this folder is an application.cfc and a subfolder named "subfolderB'  Within subfolderB I also have an application.cfc

The code within folderA/application.cfc is as follows:

<cfcomponent>
    <cfset this.name               = "test1">
    <cfset this.sessionManagement  = "true">
    <cfset this.clientManagement   = "false">
    <cfset this.setClientCookies   = "true">
    <cfset this.applicationTimeout = CreateTimeSpan(2,0,0,0)>
    <cfset this.sessionTimeout     = CreateTimeSpan(0,0,20,0)>
</cfcomponent>

The code within folderA/subfolderB/application.cfc is as follows:

<cfcomponent extends="../Application">
    <cfset this.name               = "test1">
    <cfset this.sessionManagement  = "true">
    <cfset this.clientManagement   = "false">
    <cfset this.setClientCookies   = "true">
    <cfset this.applicationTimeout = CreateTimeSpan(2,0,0,0)>
    <cfset this.sessionTimeout     = CreateTimeSpan(0,0,20,0)>
</cfcomponent>

 

What value do I need in the 'extends' in order to have the subfolderB application.cfc extend the application.cfc located in the parent folder?  Can it be a relative path?  Does it have to be a mapping to the parent folder?

 

Thanks,

Randy

    This topic has been closed for replies.

    1 reply

    Charlie Arehart
    Community Expert
    Community Expert
    December 20, 2017

    This is not a new problem. There are posts from 2006 and earlier that address this with an alternative solution:

    Extending the root Application.cfc - Dan's Shorts

    Extending Your Root Application.cfc — An Architect's View

    I will say that sometimes things like that (which did not work in the past) may have solutions which also didn't also work then but may in later versions. Also, they may have been trying to solve a specific problem different than your own.

    So first, I assume you confirmed that "..\" made no difference, right?

    Second, to be clear, is "foldera" WITHIN the root of your web site, or IS IT the root of your website? If the latter, what about extends-"\Application.cfc"? That would reach that one as found IN the root of the site. Or if folderA is one down within the root, how about extends "\folderA\Application.cfc"? (And if those fail, try the different slash, /.)

    /Charlie (troubleshooter, carehart. org)