Code created mappings are not web accessible

Hi Everyone,

I am trying to get as much of the config that I normally set via he Lucee Admin into Application.cfc.
However I have hit a snag, whereby code-created mappings are NOT web accessible and the JSON provided in the Server Admin, currently reads;
// "Inspect Templates (CFM/CFC)"/"Web Accessible" setting not supported with application type mappings

I found the following similar issue ; LDEV-2205 : but it is the reverse, stating that code created mappings should NOT default to being available in web contexts. Despite still being an open issue - I would say it has been over corrected, in its current state.

Can I create an issue for providing the “Web Accessible” functionality from the Lucee Admin to “code created” mappings?

As always thanks!

Don’t forget to tell us about your stack!

OS: Ubuntu (WSL2 on Windows 10)
Java Version: OpenJDK 11
Tomcat Version: 9
Lucee Version:

Even if you created an infinite number of web contexts, those contexts become real objects read by Tomcat, which requires a re-init of Tomcat.

The better solution (IMHO) is control your application via db query, when you add a new request URL, you place it into the table and it becomes part of your application without restart.

The other item is if this is one of those, OMG I NEED THIS, see if you cant sponsor that feature.

I hadn’t thought of that…
Whether it be in the Application.cfc or via a DB query - it’s still Application specific : nice.

I am still trying to get my head around;
Why is setting it in Application.cfc for “THIS” application, not working for “THIS” application?

And I realise the difference is “adminAPI” is quite possibly a different object / process used to the Lucee Admin GUI, so following;
When you click “Make Web Accessible” in Lucee Admin it does “extra” work, compared to the adminAPI.

Am I missing something else, or is it (to get what I want) - add the same “extra” work to the adminAPI object?

As for paying for work - we’re not against that - and we’re also not against, self-sponsoring by making the changes we want and offering them as a PR. It would all be a matter of urgency, skill level, is there some other (store it in the App DB) sensible solution?


I helped Gavin with this question in CFML Slack and I’ll reproduce part of what I said there. Basically the goal was to be able to influence where Lucee found a .cfm file in the URL with an Application specific this.mappings mapping. I’ll copy/paste part of that convo:

The issue is, that mappings defined in the Application.cfc are not “Web Accessible”,

No, this is not correct. This has nothing to do with whether or not the CF admin is “web accessible” and has everything to do with a chicken/egg problem

Mappings in an Application.cfc can’t affect the resolution of a .cfm file in the URL because this is the order things happen in

  • request for /foo/bar.cfm comes in
  • Lucee finds physical file on disk
  • Lucee uses rules to locate the applicable Application.cfc or Application.cfm (known as the application listener)
  • Lucee creates the app listener, which executes the pseudo constructor
  • Lucee processes onRequestStart/onRequest methods
  • Lucee finally runs bar.cfm

The issue is you want a mapping that doesn’t exist on until bullet #4 to influence a decision that happens back in bullet #2!

So the issue isn’t that Lucee knows about your mapping, but it’s wrong type, the issue is Lucee never knows about your mapping because Lucee never even finds that Application.cfc because Lucee never finds the cfm you want to run in the first place!

The rule here is simple, when you want to run cfm’s from a virtual directory, you need to create the matching mapping in the Lucee admin, which is global to add applications.

Now, what you need to do is vote for this ticket

[LDEV-694] - Lucee

This sort of crap “just works” in Adobe CF because it uses the servlet context’s getRealPath() method to help location the file

Lucee doesn’t do this, and you can see this ticket from 2016 in the backlog with a suggested fix getting no feedback

If this ticket was in place, you wouldn’t even be having this issue

So to recap, Application-specific mappings are not “web accessible” because it’s literally impossible for them to be.

Thanks Brad for the explanation.
I’m a lot clearer, now.

Looks like another candidate for better documentation. At the moment, the Lucee Server Admin has;

// “Inspect Templates (CFM/CFC)”/“Web Accessible” setting not supported with application type mappings

which I read as “We haven’t gotten around to doing some work”…
Which true, from the perspective of LDEV-694, it isn’t really that it is not supported, it’s moreso something like;
“Cannot be used to identify cfm path resolution, when set only within Application.cfc code.”


1 Like

@Gavin_Baumanis please see my new comment on the issue you referenced: [LDEV-2205] - Lucee
It contains example that may get you the behavior you’re looking for. Brad’s explanation of the behavior there is also helpful.

Thanks @sbleon,
In our instance - this doesn’t help in all scenarios.
I.e. we’re using the MachII framework - which extends the Application.cfc - so the mappings don’t exist yet…

We got around this specific issue by placing the machii.cfc directly in the {approot}.
The next issue is that CFC attempts to include files by a “mapping” - so the onRequestStart change you have - doesn’t work for us here.

We’ll just have to continue to use mappings that are in the Lucee Admin - so that we continue with our application’s code as it is currently written.

Ultimately - my issue arose because I am trying to make everything a part of the application itself - so we can “plonk” it into any server and it just works.