在我看来,当请求不存在的 Mura FW/1 插件操作时,抛出 404 是有意义的。
例如,如果请求https://local.mysite.info/trainings/?calendaraction=main.thisActionIsBogus(指放置在区域中的插件内容对象),我希望呈现站点 404。我不知道a)这是否可能或b)如何实现它。
以下是插件中的一些愚蠢的实验Application.cfc
:
public any function onMissingView(any rc) {
var $ = rc.$;
// yields redirect loop
// application.serviceFactory.getBean('contentServer').render404();
/* yields:
* variable [OUT] doesn't exist at lucee.runtime.type.scope.UndefinedImpl.get(UndefinedImpl.java:226):226 at
* includes.fw1_cfc$cf.udfCall5(/var/www/vmhost/apps/mysite/cfml/deployment_root/wwwroot/plugins/calendar/includes/fw1.cfc:825):82
* ... */
//$.event('content', $.getBean('content').loadBy(filename='404'));
// yields: component [calendar.Application] has no function with name [doAction]
//getPageContext().forward("https://local.mysite.info/404/"));
// works, sort of, but not well: gives a 302, then the plugin-specific
// 404 view kicks in and returns 404
//redirect(action="public:errors.404"); // , queryString="template=json"
// yields: component [calendar.Application] has no function with name [doAction]
//getPageContext().forward("https://local.mysite.info/404/"));
}