mapping in application.cfc vs. web-admin

162 views
Skip to first unread message

Michael Hnat

unread,
May 17, 2015, 4:28:24 PM5/17/15
to lu...@googlegroups.com
Hi,
 
I tried moving my mappings from the web-admin to the application.cfc.
But I have a problem with a application.cfc mapping and cfimport
 
This is happening:
Without Mapping:
<cfinclude template="m/lib/lib.cfm" /> <!--- Works --->
<cfimport taglib="m/lib/yform" prefix="yform" /> <!--- Works --->
 
Mapping in lucee web-admin:
<cfinclude template="/libadmin/lib.cfm" /> <!--- Works --->
<cfimport taglib="/libadmin/yform" prefix="yform2" /> <!--- Works --->
 
Mapping in application.cfc:
<cfinclude template="/lib/lib.cfm" /> <!--- Works --->
<cfimport taglib="/lib/yform" prefix="yform3" /> <!--- Fails --->
 
Is this a normal behaviour? If yes, please explain the difference.
 
Actually my idea was to have a configurationfile for everything without touching the admin.
 
My System is Win7, Lucee Exress, 4.5.1.000
 
Best,
Michi
 

Adam Cameron

unread,
May 17, 2015, 5:15:57 PM5/17/15
to lu...@googlegroups.com
On 17 May 2015 at 21:28, 'Michael Hnat' via Lucee <lu...@googlegroups.com> wrote:
 
Mapping in application.cfc:
<cfinclude template="/lib/lib.cfm" /> <!--- Works --->
<cfimport taglib="/lib/yform" prefix="yform3" /> <!--- Fails --->
 
Is this a normal behaviour? If yes, please explain the difference.
 

Sounds like what Scott Stroz put me onto in this blog article:

I never bothered to follow-up what Railo's position was on this behaviour.

-- 
Adam 

Michael Hnat

unread,
May 18, 2015, 3:15:59 AM5/18/15
to lu...@googlegroups.com

Is there anything you haven't written an article about?? Seriously!

 

From my point of view this is a bug. I think the setting in the application.cfc should work like in the admin. Especially when the admin is telling me "take this code snippet and put it in your application.cfc".

 

Best, Michi

--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/CAOPrabWVSHL03ciNe%3D41tq7B1Mtxttg0m9ajigso7%2BV__bNkag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Adam Cameron

unread,
May 18, 2015, 3:26:38 AM5/18/15
to lu...@googlegroups.com


On Monday, 18 May 2015 08:15:59 UTC+1, Michael Hnat wrote:

Is there anything you haven't written an article about?? Seriously!


Haha, well one of the main reasons I started the blog is to build a reservoir of docs explaining issues ppl have. The other was unabashed self-promotion. I dunno which is the primary driver ;-)

 

From my point of view this is a bug. I think the setting in the application.cfc should work like in the admin. Especially when the admin is telling me "take this code snippet and put it in your application.cfc".


Certainly in the context of the bit you quote from Admin, at least that's a bug.

I guess it comes down to whether there should be an expectation that <cfimport> works like other tags that use mappings, and in that case should be able to use application-specific ones. TBH, I don't see why not.

The docs don't say anything about this one way or the other: http://docs.lucee.org/reference/tags/import.html (probably a candidate for an update, once the "official" position is known here). At the very least perhaps adding "doesn't work with application mappings" might be a good addition... I need to work out how to edit these things, so might see if I can add that as an experiment.

-- 
Adam


Chris Blackwell

unread,
May 18, 2015, 3:59:31 AM5/18/15
to lu...@googlegroups.com

My understanding ( from Sean Corfield ) is that cfimport is a compile time directive, but application.cfc mappings are runtime. Hence you can not cfimport a tag based on a application.cfc mapping.

Mappings in Web or server admin are known when your template  is compiled, so they work ok

This should probably be clarified in the docs for mappings (do they exist?) and cfimport.


--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

Adam Cameron

unread,
May 18, 2015, 4:15:24 AM5/18/15
to lu...@googlegroups.com


On Monday, 18 May 2015 08:59:31 UTC+1, Chris Blackwell wrote:

My understanding ( from Sean Corfield ) is that cfimport is a compile time directive, but application.cfc mappings are runtime. Hence you can not cfimport a tag based on a application.cfc mapping.


Yeah, I'm not so sure about that being true.

If one changes the location of a mapping in admin, then reuse a file which had previously leveraged that mapping, the change is reflected but the file is not recompiled.

I've perhaps got my lunchtime blog article topic sorted out now ;-)

-- 
Adam 

Michael Hnat

unread,
May 18, 2015, 10:11:11 AM5/18/15
to lu...@googlegroups.com

In his lunchtime Adam wrote a whole article on my mapping issue: http://blog.adamcameron.me/2015/05/lucee-cfml-import-and-application-set.html

 

I raised a Feature-Request in Jira for that: https://luceeserver.atlassian.net/browse/LDEV-355

 

 

Best,

Michi

 

Von: lu...@googlegroups.com [mailto:lu...@googlegroups.com] Im Auftrag von Adam Cameron
Gesendet: Montag, 18. Mai 2015 10:15
An: lu...@googlegroups.com
Betreff: Re: [Lucee] mapping in application.cfc vs. web-admin

 

--

You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

Jochem van Dieten

unread,
May 18, 2015, 2:01:37 PM5/18/15
to lu...@googlegroups.com
On Mon, May 18, 2015 at 10:15 AM, Adam Cameron wrote:
On Monday, 18 May 2015 08:59:31 UTC+1, Chris Blackwell wrote:

My understanding ( from Sean Corfield ) is that cfimport is a compile time directive, but application.cfc mappings are runtime. Hence you can not cfimport a tag based on a application.cfc mapping.

Yeah, I'm not so sure about that being true.

If one changes the location of a mapping in admin, then reuse a file which had previously leveraged that mapping, the change is reflected but the file is not recompiled.

 If you want real fun, try this with Adobe's cfcompile.bat for offline compilation.

Jochem



--

Doug Roberson

unread,
May 19, 2015, 7:25:29 AM5/19/15
to lu...@googlegroups.com
I tried to use aplication.cfc to map a DSN a few times using the code from the web-admin page but I didn't have something configured correctly. 

Could anybody share an example of a working cfc with mapping? I'd love to see what works for you guys. 


Reply all
Reply to author
Forward
0 new messages