REST mapping always shown red on admin page

Hi.

I’m trying to run a simple REST service.

I am running lucee on ubuntu22.04 on WSL on Windows11.
I installed a lucee-express and replaced lucee.jar with
lucee-6.0.0.533-SNAPSHOT.jar that I built from source
at the tip of the “6.0” branch.

When I define a REST mapping, it is always shown in red on the admin page.

After looking into the source of the admin page, and the java classes behind,
I noticed the following:

  • The page is rendered by src/main/cfml/context/admin/resources.rest.cfm. The line will be shown in red if “rest.physical” is empty but “rest.strPhysical” is not empty. strPhysical is what the user entered on the screen.
<cfset css=iif(len(rest.physical) EQ 0 and len(rest.strPhysical) NEQ 0,de('Red'),de(''))>
  • The conversion from strPhysical to physical takes place in the constructor of the Mapping class at src/main/java/lucee/runtime/rest/Mapping.java . The member variable “physical” is set after the user supplied argument “physical” is converted using ConfigWebUtil.getExistingResource. However that conversion only takes place when the argument “config” implements ConfigWeb. During my testing this condition always seemed to be false and as a result the “physical” member variable does not get set. By adding some logging, I discovered that the type being passed is a ConfigServerImpl object, which does not implement ConfigWeb.
	public Mapping(Config config, String virtual, String physical, boolean hidden, boolean readonly, boolean _default) {
		if (!virtual.startsWith("/")) this.virtual = "/" + virtual;
		if (virtual.endsWith("/")) this.virtual = virtual.substring(0, virtual.length() - 1);
		else this.virtual = virtual;

		this.strPhysical = physical;
		this.hidden = hidden;
		this.readonly = readonly;
		this._default = _default;

		if (!(config instanceof ConfigWeb)) return;
		ConfigWeb cw = (ConfigWeb) config;

		this.physical = ConfigWebUtil.getExistingResource(cw.getServletContext(), physical, null, cw.getConfigDir(), FileUtil.TYPE_DIR, cw, true);

	}

Am I misunderstanding something?

I found out that switching the admin mode from single mode to multi mode and configuring at the per-web configuration makes the setting work. In the web admin, the said config object is ConfigWeb.

I can live with this, but I think this is a bug.

1 Like

I’ve added a bug to
https://luceeserver.atlassian.net/browse/LDEV-4775

1 Like

Hi,

Any update on this? I spun up Lucee specifically for an API.

I think you’ll need to use REST in Lucee 6 in Multi-Mode until this gets fixed.

ok, thanks