A preProcess interceptor wants to run a different event without redirecting

Is there some way for a preProcess interceptor to run a different
event than the one spec'd by the url? Under some circumstances, a
bunch of different events should all deliver the same not-the-usual
response. Ideally they wouldn't redirect, just deliver deliver this
alternate result, as if a different event had been requested.

Running the alternate event is easy, just runEvent(alternateEvent),
but the action invoked by the url still happens. As I understand it,
if a preProcess interceptor returns true, then later interceptors
won't get called, and if you call noRender() then no response is sent,
but the event still runs. I don't see any way other than setNextEvent
to say "don't run the real url event".

Is there a way to accomplish something like this? Some other way to
think about it?


Found it I think, overrideEvent(). Still some who's-on-first to work
out, but that looks like the foundation.


Interceptors are so cool because they can do exactly what you request: change the event. For example, the SES Core Interceptor does exactly that. It identifies a route you have registered and if a match is found it redirects the event to execute. The only thing you really need to pay attention to for your use case is the order in which you register your interceptor.

Here is the code you need:

void function preProcess(Event,struct interceptData)

var rc = event.getCollection();

rc[getSetting(‘EventName’)] = 'FooHandler.BarEvent;


Aaron Greenlee

overrideEvent() is the cleaner way. You’ve solved it!

Thanks :slight_smile: