I'm on ColdBox 3.0.0 Beta 3 and have the following setting in my
ColdBox XML file:
<Setting name="onInvalidEvent" value="Sorry.pageNotFound"/>
In Sorry.pageNotFound(), I expected to be able to access the invalid
event key but it's missing:
public void function pageNotFound( any event ) {
var rc = event.getCollection();
createObject( 'java', 'java.lang.System' ).out.println( 'I handled
an invalid event!' );
// rc.invalidevent ought to be present but doesn't seem to be...
createObject( 'java', 'java.lang.System' ).out.println( 'Event: ' &
rc.invalidEvent );
}
It looks like HandlerService.cfc should put the runnable event name
into that event key in one place but not in a later place:
lines 133-137:
//Place invalid event in request context.
oRequestContext.setValue
("invalidevent",oEventHandlerBean.getRunnable());
// Relocate to Invalid Event, with collection persistance
controller.setNextEvent(event=controller.getSetting
("onInvalidEvent"),persist="invalidevent");
lines 249-259:
// If onInvalidEvent is registered, use it
if ( len(trim(onInvalidEvent)) ){
// Test for invalid Event Error
if ( compareNoCase(onInvalidEvent,event) eq 0 ){
getUtil().throwit(message="The onInvalid event is also invalid",
detail="The onInvalidEvent setting is also invalid:
#onInvalidEvent#. Please check your settings",
type="HandlerService.onInValidEventSettingException");
}
// Relocate to Invalid Event
controller.setNextEvent(event=onInvalidEvent);
}
Is there a reason for this difference or is it just a bug?
Sean