0

In my opinion, it makes sense to throw a 404 when a non-existent Mura FW/1 plugin action is requested.

For example, if https://local.mysite.info/trainings/?calendaraction=main.thisActionIsBogus (referring to a plugin content object placed in a region) is requested, I'd like the site 404 to be rendered. I don't know a) if this is possible or b) how to implement it.

Here are some goofy experiments in the plugin's 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/"));
}
Jamie Jackson
  • 1,158
  • 3
  • 19
  • 34
  • What happens if you just set a `404` status code and let the processing continue? `` – Miguel-F Nov 02 '16 at 12:33
  • @Miguel-F: That yields a FW/1 error. If I also add `variables.out = "have to add something here or i get a fw/1 error";`, I no longer get the error, but the result is that whatever I put in `variables.out` is then presented in the content area. The 404 status is reflected, but the page isn't what I want (the site 404). (https://git.io/vXGFK) – Jamie Jackson Nov 02 '16 at 19:16
  • The way I have called out the Mura 404 page before was like this ' '. That was done in a CFML template however, not within the Application.cfc so not sure if it will work there. – Miguel-F Nov 02 '16 at 20:12

0 Answers0