cfimport with app specific mappings?

133 views
Skip to first unread message

Mark Mandel

unread,
Apr 12, 2012, 10:00:09 PM4/12/12
to ra...@googlegroups.com
I assume that cfimport doesn't work with app specific mappings, like it does with ACF9+ ?

Just tried in on our production system, and got the error: 'invalid definition of the attribute taglib [/app/customtags/template]'

If not, should I start a new bug, or should we reopen https://issues.jboss.org/browse/RAILO-184 ?

Michael Offner

unread,
Apr 16, 2012, 8:20:59 AM4/16/12
to ra...@googlegroups.com
Sean writes in the comments of ticket 184 that this is also not the case with ACF, the ticket is set to "Cannot Reproduce Bug". you can always reopen tickets with this state. if you have additional info (best is always a testcase), but just reopen the ticket with no additional info is useless of course.

/micha


2012/4/13 Mark Mandel <mark....@gmail.com>

Michael Offner

unread,
Apr 16, 2012, 8:34:36 AM4/16/12
to ra...@googlegroups.com
i have testest again the attached testcase on latest version of
- ACF9
- ACF10 (Beta1)
- Railo 3.3.2

all with the same result (exception). mapping is not recognized and like sean is writing for a good reason, cfimport-taglib is a setting for the compiler and per application mapping are only for the runtime environment.

/micha 

2012/4/16 Michael Offner <mic...@getrailo.com>

Matt Quackenbush

unread,
Apr 16, 2012, 8:51:31 AM4/16/12
to ra...@googlegroups.com

cfimport has always required an admin mapping if a mapping is used.

Sent from my Samsung Galaxy SII

Mark Mandel

unread,
Apr 16, 2012, 9:47:34 AM4/16/12
to ra...@googlegroups.com
Weird, because that supplied code works on our production systems... I will have to double check.

Mark

Scott Stroz

unread,
Feb 4, 2014, 8:00:00 AM2/4/14
to ra...@googlegroups.com, mark....@gmail.com
I am trying to test some code that runs without issue on ColdFsuion 9.0.2 that uses cfimport and per app mappings (not mappings in the admin) and I am getting errors with running this code in Railo Express 4.2.

Has there been any other headway on thsi issue?

Mark Drew

unread,
Feb 4, 2014, 8:26:54 AM2/4/14
to ra...@googlegroups.com, Mark Mandel
Show your code. I.e you application.cfc and your import. 

Give us some code to reproduce. 

Regards
Mark Drew
Sent from a mobile device
--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/f0fa0285-bf4f-4f51-95a0-3d66e7ba69db%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Scott Stroz

unread,
Feb 4, 2014, 8:44:50 AM2/4/14
to ra...@googlegroups.com, Mark Mandel
I guess that would help.......

In Application.cfc, I have the following

rootDir = getDirectoryFromPath(getCurrentTemplatePath());
this.mappings[ "/ui" ] = rootDir & '../ui';

In a .cfm file, I have the following:

<cfimport taglib="/ui/customTags" prefix="v" />

The error I get in Railo Express 4.1.2.005 is 'invalid definition of the attribute taglib [/ui/customTags]'

This is working in ACF 9.0.1 (locally) and ACF 9.0.2 (on my server) without mappings in the CF Admin.

Interestingly enough, I am trying to run the code Micha posted on the Jira ticket - https://issues.jboss.org/browse/RAILO-184 and I get errors in both Railo and ACF 9.0.1.

Carl Von Stetten

unread,
Feb 4, 2014, 12:04:27 PM2/4/14
to ra...@googlegroups.com
I thought mappings were for CFCs only. Wouldn't you want to define
this.customtagpaths instead?

And I had no idea that you could create a path like this: rootDir &
'../ui'; I would have assumed that wouldn't work. That's pretty cool!

-Carl V.

Scott Stroz

unread,
Feb 4, 2014, 12:06:46 PM2/4/14
to ra...@googlegroups.com
Mappings can be used for lots of thing - includes as well.

I tried fixing the issue by using this.customtagpaths and then just doing <cf_tehTagIAmCalling ... /> in my code and that failed in both ACF and Railo.



Scott Stroz
http://www.boyzoid.com
--------------------------------------------------
No trees were killed in the sending of this message, but a large number of electrons were terribly inconvenienced


--
Did you find this reply useful?  Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
--- You received this message because you are subscribed to a topic in the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/52F11D9B.7040301%40vonner.net.

Carl Von Stetten

unread,
Feb 4, 2014, 12:16:19 PM2/4/14
to ra...@googlegroups.com
Did you try the <cfimport> in tandem with this.customtagpaths?

-Carl V.

Scott Stroz

unread,
Feb 4, 2014, 12:19:29 PM2/4/14
to ra...@googlegroups.com
Aye.



Scott Stroz
http://www.boyzoid.com
--------------------------------------------------
No trees were killed in the sending of this message, but a large number of electrons were terribly inconvenienced


--
Did you find this reply useful?  Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
--- You received this message because you are subscribed to a topic in the Google Groups "Railo" group.

Carl Von Stetten

unread,
Feb 4, 2014, 12:44:12 PM2/4/14
to ra...@googlegroups.com
I got nothin. :-\

-Carl V.

Mark Drew

unread,
Feb 4, 2014, 12:45:58 PM2/4/14
to ra...@googlegroups.com
Looking into this, custom tags seem to be working but the <cfimport> doesnt
Igal or Micha might be able to drop in tonight or tomorrow. 

I havebt tried it but I think you can put a default for any tag in Railo 4.2 by doing something like:


this.tags.cfimport.taglib = "path";

so you can just set the default for that attribute anyway. 

Sorry bout that. 

MD


--
Did you find this reply useful?  Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
--- You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/52F126EC.2080104%40vonner.net.

For more options, visit https://groups.google.com/groups/opt_out.



--
Mark Drew
Railo Technologies      Professional Open Source
skype: mark_railo        ma...@getrailo.com
+44 7971 852296           www.getrailo.com

Scott Stroz

unread,
Feb 4, 2014, 5:35:57 PM2/4/14
to ra...@googlegroups.com
Weird....if I use this in Application.cfc

this.customTagPaths = expandPath( rootdir & "../ui/customTags/" );

I can call custom tags using the 'cf_' syntax in Railo and it works, but ACF throws an error that it cannot find the files.



Scott Stroz
http://www.boyzoid.com
--------------------------------------------------
No trees were killed in the sending of this message, but a large number of electrons were terribly inconvenienced


You received this message because you are subscribed to a topic in the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/CANUZm74-6GRO3XySGytb5B-FeaomX5zrRm00WuQcw9%2BZreFaSQ%40mail.gmail.com.

Scott Stroz

unread,
Feb 4, 2014, 5:42:25 PM2/4/14
to ra...@googlegroups.com
I was able to get this working consistently in both ACF and Railo by using:

<cfmodule template="/ui/customTags/pageIWant.cfm" ... />

Ugly...but it works. But, now I need to go replace all those <cfimports>



Scott Stroz
http://www.boyzoid.com
--------------------------------------------------
No trees were killed in the sending of this message, but a large number of electrons were terribly inconvenienced


Scott Stroz

unread,
Feb 4, 2014, 7:44:01 PM2/4/14
to ra...@googlegroups.com
Mark,

I tried using what you suggested. I added the following to Application.cfc

this.tags.cfimport.taglib = "/ui/customTags";

And then used the following in a .cfm page:

<cfimport  prefix="v" />

But received the following error

Wrong Context, missing attribute [taglib] for tag cfimport

Scott Stroz

unread,
Feb 4, 2014, 7:51:42 PM2/4/14
to ra...@googlegroups.com
Duh......I forgot about Railo's Web Administrator'. I simply created a mapping there - for just the single application - and everything works fine.

Move along...nothing more to see here.....

Gert Franz

unread,
Feb 5, 2014, 1:48:41 AM2/5/14
to ra...@googlegroups.com
Still, it's an issue we will fix :-)

Gert

Von meinem iPad gesendet

Chris Blackwell

unread,
Feb 5, 2014, 5:51:47 AM2/5/14
to railo
I thought that you couldn't use application mappings for cfimport because cfimport is compiled, not runtime.  Hence the railo admin mappings will work but application.cfc mappings (which are runtime) will not.

I am surprised it works in ACF


Scott Stroz

unread,
Feb 5, 2014, 8:01:52 AM2/5/14
to ra...@googlegroups.com
Chris,

Honestly, I am too. There is a Jira ticket about this issue to which Micha had attached some test code. I am unable to run that test code in CF 9,0.1.

But, in my application it works on 9.0.1 (locally) and 9.0.2 (on my server). It is entirely possible that I had issues with this initially and had to do something to get it working and just cannot remember...stupid old brain. I have verified that both locally and on the server, there are no mappings in the Cf Administrator.

I have spent a lot of my spare time the last few days testing to see if the application works in Railo (which it does...w00t), so I have not had the opportunity to really investigate the ACF side of things.



Scott Stroz
http://www.boyzoid.com
--------------------------------------------------
No trees were killed in the sending of this message, but a large number of electrons were terribly inconvenienced


You received this message because you are subscribed to a topic in the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/CAB%3DtfToyLfUgRz_npEgycGbp3HrPnntZLX5HhfTjnMAacB9EhQ%40mail.gmail.com.

Matt Quackenbush

unread,
Feb 5, 2014, 8:12:16 AM2/5/14
to ra...@googlegroups.com
I'm with Chris. App-specific mappings have never worked for <cfimport> because of the runtime aspect of it. Years ago I _thought_ I had it working, but if memory serves me correctly (that's a big IF, given the number of years it's been), it ended up being a virtual directory/alias at the web server level which caused the app-specific mapping to *appear* to work. I'm gonna guess you've got something similar going on.


Scott Stroz

unread,
Feb 5, 2014, 8:20:12 AM2/5/14
to ra...@googlegroups.com
Adam Cameron and I went down that path already. I do not have a virtual directory locally, nor on the server.


I have several apps at work where we are doing the same thing and I will peruse our 'set up' instructions for new devs to see if that sheds any light.



Scott Stroz
http://www.boyzoid.com
--------------------------------------------------
No trees were killed in the sending of this message, but a large number of electrons were terribly inconvenienced


Jochem van Dieten

unread,
Feb 5, 2014, 9:29:17 AM2/5/14
to ra...@googlegroups.com
On Wed, Feb 5, 2014 at 11:51 AM, Chris Blackwell wrote:
I thought that you couldn't use application mappings for cfimport because cfimport is compiled, not runtime.

You can, just not if you use Adobe's offline cfcompile utility.

Jochem


--
Jochem van Dieten
http://jochem.vandieten.net/

Scott Stroz

unread,
Feb 5, 2014, 11:34:21 AM2/5/14
to ra...@googlegroups.com
So...I figured out how it is working in my applications, but not in simple test cases.

The places where it is working in ACF are in view files in a FW/1 application. The way these files are 'included' seems to make it so the per application mappings are indeed applied in the <cfimport>. A simple test case where a file cfincludes a file with the cfimport using the per app mapping does indeed work.

I am downloading Railo express to my work laptop to check if this new test case will work, though, considering my application didn't work, I suspect neither will this new test case.

The fact that this did not work in Railo leads me to believe that there is a difference in how/when the files are processed.



Scott Stroz
http://www.boyzoid.com
--------------------------------------------------
No trees were killed in the sending of this message, but a large number of electrons were terribly inconvenienced


--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to a topic in the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/CABPCP-3kiqYDSojJBqnKg3T8zqv2PAfa5%2B1JGF0UYp5aCB6jmQ%40mail.gmail.com.

Scott Stroz

unread,
Feb 5, 2014, 12:05:47 PM2/5/14
to ra...@googlegroups.com
Attached is a test case that works in ACF 9 & 10, but does not work in Railo 4.1 (Express).

Drop these files into a directory at least one level below web root (for ACF) and browse to ...../importtest/test.cfm this works. This same code does not work on Railo.

I am not sure if this is a 'bug' as much as it is simply a difference in behavior - so I will hold off on filing one until someone thinks it should be reported as a 'bug'
test.zip

Adam Cameron

unread,
Feb 11, 2014, 7:05:31 PM2/11/14
to ra...@googlegroups.com
Is there a Jira ticket for this? I have to concede I have not tried Scott's repro case, but I find the whole thing quite interesting...

-- 
Adam

Adam Cameron

unread,
Feb 16, 2014, 2:19:09 AM2/16/14
to ra...@googlegroups.com


On Thursday, 6 February 2014 05:34:21 UTC+13, Scott Stroz wrote:
The way these files are 'included' seems to make it so the per application mappings are indeed applied in the <cfimport>. A simple test case where a file cfincludes a file with the cfimport using the per app mapping does indeed work.

This is indeed odd. Just running your code on ColdFusion 10 yields unexpected behaviour.

Test 1:
  • hit test.cfm
  • hit myInclude.cfm
Both work fine.

Test 2:
  • hit myInclude.cfm - error relating to path not being resolved
  • hit test.cfm - runs fine
  • re-hit myInclude.cfm - now runs fine
I can replicate these behaviours reliably.

So... to me... at the very least you have uncovered a bug in ColdFusion. It just depends which is the expected behaviour: the import should either always work, or never work. It should not work sometimes, and depending on a sequence of files being run.

As to whether there's anything to fix in Railo here depends on how ColdFusion is supposed to work, I guess.

I suspect Railo is getting it right, and ColdFusion has a) a bug in that it behaves differently depending on the order files are called; b) that it ever works. I think the intent is that mappings should not work here. Because that's what it says in the docs ("cfimport"): 

The path must be relative to the web root (and start with /), the current page location, or a directory specified in the Administrator ColdFusion mappings page.

Given it's specific wording to mention a mapping created in CFAdmin, I would interpret that as excluding a mapping made in Application.cfc. Otherwise they'd just say "a mapping".

-- 
Adam
Reply all
Reply to author
Forward
0 new messages