On 20/09/2010 19:19, Peter J. Farrell wrote:
Inline below...

Phil Ewington said the following on 09/20/2010 06:53 AM:
Hi All,

A little confusion over firstly how to achieve a redirection to an event that is determined dynamically and secondly the best practises for doing so.

The problem.... I have an event-handler calling an event filter to determine which events to announce. That all works as expected.... I then want to redirect to an event that is determined by the filter. If I put...

<cfset variables.nextEvent = iif(getProperty("SessionFacade").getDefaultCalendar() eq "M", de('showMonthlyCalendar'), de('showWeeklyCalendar')) /> <cfset redirectEvent(variables.nextEvent, arguments.event.getArgs(), true) />

at the end of my filter it redirects but my previously announced events do not run.
A redirect is just like a cflocation -- all even queue processing stops (including an events in the queue).
This is what confused me. I thought it queued the redirect to occur once all other events had processed.

I have also tried separating the code across two filters, one that announces events, the other that runs the redirect code as above and added both filters to my event-handler....

<event-handler event="updateEvent" access="public">
<filter name="UpdateCalendarEventFilter" />
<filter name="CalendarEventRedirectFilter" />
</event-handler>

This is where you would need to "queue" the redirect by having your CalendarEventRedirectFilter *announce* an event-handler that has either a <redirect> command or a filter/listener that calls redirectEvent() for you. You can do this by creating a generic event-handler like my example below.
OK, so a redirectEvent command can queue the redirect action but only if called from another event-handler? Think it would be great to extend the redirectEvent command to allow a flag to queue the redirect, would save on creating event-handlers just for that purpose. Just a thought ;)

I have other event-handlers that redirect without any logic that work fine by simply creating an event-handler like....

<event-handler event="myEvent" access="public">
<notify method="myListener" method="myMethod" />
<redirect event="nextEvent" />
</event-handler>

Can I use variables in my mach-ii.xml file? How do I achieve what I am after? Any pointers will be greatly appreciated.
We only allow them in certain places.  You could do this:

<event-handler event="something" access="private>
         <redirect  event="${event.nameOfEventArgWithEventNameInIt}"  
persist="true"/>
</event-handler>

It's all documented in our XML syntax:

http://trac.mach-ii.com/machii/wiki/ConfigFileExplained

HTH,
.Peter



Thanks for your help Peter, very much appreciated!

- Phil.

--
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en

***New URLs as of April 29th, 2010***
SVN: http://svn.mach-ii.com/machii/
Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/

Reply via email to