Look at the documentation for Event.

You should find a methos that does what you need.

DW

Sent from a mobile. Please excuse brevity and typos. 

-----Original Message-----
From: jet <[email protected]>
Sender: [email protected]
Date: Tue, 2 Nov 2010 14:38:10 
To: model-glue<[email protected]>
Reply-To: [email protected]
Subject: [Model-Glue] Re: Setting up a maintenance page

K, I got it working with the following:

        <cffunction name="CheckMaintenanceMode" access="public"
returnType="void" output="false">
                <cfargument name="event" type="any">
                <cfset var IsMaintenanceMode =
arguments.event.getValue("IsMaintenanceMode",0) />
                <cfset var ExceptionIPs = "xx.xx.x.xxx" />

                <cfif NOT IsMaintenanceMode and NOT
ListFind(ExceptionIPs,CGI.REMOTE_ADDR)>
                        <cfset arguments.event.setValue("IsMaintenanceMode",1) 
/>
                        <cfset 
arguments.event.addResult("MaintenanceModeEvent") />
                </cfif>
        </cffunction>

But is it possible to check if MaintenanceModeEvent exists in event?
I'd rather do that then setting
arguments.event.setValue("IsMaintenanceMode",1).


On Nov 2, 11:43 am, Dan Wilson <[email protected]> wrote:
> Yeah, that's because when the onRequestStart happens, it goes through the
> loop again and does another redirect.
>
> You are almost there.  You may need to add logic in
> your CheckMaintenanceMode controller method to not add the result again,
> since it's already in the queue.
>
> DW
>
>
>
> On Tue, Nov 2, 2010 at 2:34 PM, jet <[email protected]> wrote:
> > Yeah, i tried that but i get the following error.
>
> > "The page isn't redirecting properly
> > Firefox has detected that the server is redirecting the request for
> > this address in a way that will never complete."
>
> > On Nov 2, 11:23 am, Dan Wilson <[email protected]> wrote:
> > > Of course it would. That's how results work. You generally want to add
> > > things to the queue and execute them.
>
> > > Specifically, if you want to stop processing and only process the event
> > > handler, you want to use the redirect attribute:
>
> > >http://docs.model-glue.com/wiki/ReferenceMaterials/ModelGlueXmlRefere...
>
> > > This:
>
> > >                                <result name="MaintenanceModeEvent"
> > > do="MaintenanceMode" />
>
> > > Becomes this:
>
> > >                                <result name="MaintenanceModeEvent"
> > > do="MaintenanceMode" redirect="true" />
>
> > > DW
>
> > > On Tue, Nov 2, 2010 at 2:19 PM, jet <[email protected]> wrote:
> > > > Ok trying it out again, but it's not quite doing what i need it to
> > > > do.  So i got
>
> > > >                <event-handler name="ModelGlue.onRequestStart">
> > > >                        <broadcasts>
> > > >                                <message name="CheckMaintenanceMode" />
> > > >                        </broadcasts>
> > > >                        <results>
> > > >                                <result name="MaintenanceModeEvent"
> > > > do="MaintenanceMode" />
> > > >                        </results>
> > > >                </event-handler>
>
> > > >                 <event-handler name="MaintenanceMode">
> > > >                        <views>
> > > >                                <include name="template"
> > > > template="sitedown.cfm" />
> > > >                        </views>
> > > >                </event-handler>
>
> > > > And this aint working so I'm obviously missing something.
> > > > ModelGlue.onRequestStart gets picked up and it will trigger the
> > > > CheckMaintenanceMode, it does include the sitedown.cfm but instead of
> > > > stopping here it continues on to trigger anything else that was in the
> > > > queue so as a result the site behaves normally.
>
> > > > On Nov 1, 3:22 pm, jet <[email protected]> wrote:
> > > > > Yes and making an exception for my ip would be ideal, so that i can
> > > > > confirm that the changes are working correctly.  Thanks.
>
> > > > > On Nov 1, 3:20 pm, jet <[email protected]> wrote:
>
> > > > > > Thanks for all the replies.  I gave Dan's example a shot but wasnt
> > > > > > being successful.  I might have missed something.  But since I was
> > in
> > > > > > a bit of a rush to get something up and running I just created
> > events
> > > > > > to handle my template pages.  Site only had 2 main template pages
> > so i
> > > > > > jsut created events for those that would use my maintenance
> > template,
> > > > > > and renamed my original events to something else.
>
> > > > > > After i was done with teh maintenane i just switched the names of
> > the
> > > > > > events back to what they were.  Not the cleanest but it did the
> > job.
> > > > > > I'll try it out again later.
>
> > > > > > On Oct 30, 8:39 am, Jim Priest <[email protected]> wrote:
>
> > > > > > > On Sat, Oct 30, 2010 at 5:28 AM, Chris Blackwell <
> > [email protected]>
> > > > wrote:
> > > > > > > > I'd do this at the webserver level, using mod_rewrite or the
> > iis
> > > > equivalent
>
> > > >http://www.techiecorner.com/97/redirect-to-maintenance-page-during-up.
> > ..
>
> > > > > > > I've done this with Ant in my deployment scripts - flip a bit and
> > use
> > > > > > > something similar to Dan's example to redirect traffic.
>
> > > > > > > You may also want to bake some logic in there so that you (or
> > your IP
> > > > > > > range) is NOT redirected - this enables you to hit the site,
> > verify
> > > > > > > things are working, reload the framework, etc.
>
> > > > > > > Jim
>
> > > > > > > --
> > > > > > > Jim Priest | jimpriest.net | [email protected] | 919-827-1970-
> > > > Hide quoted text -
>
> > > > > > - Show quoted text -
>
> > > > --
> > > > Model-Glue Sites:
> > > > Home Page:http://www.model-glue.com
> > > > Documentation:http://docs.model-glue.com
> > > > Bug Tracker:http://bugs.model-glue.com
> > > > Blog:http://www.model-glue.com/blog
>
> > > > You received this message because you are subscribed to the Google
> > > > Groups "model-glue" group.
> > > > To post to this group, send email to [email protected]
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<model-glue%[email protected]>
> > <model-glue%[email protected]<model-glue%[email protected]>
>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/model-glue?hl=en
>
> > > --
> > > William Osler - "We are here to add what we can to life, not to get what
> > we
> > > can from life."
>
> > --
> > Model-Glue Sites:
> > Home Page:http://www.model-glue.com
> > Documentation:http://docs.model-glue.com
> > Bug Tracker:http://bugs.model-glue.com
> > Blog:http://www.model-glue.com/blog
>
> > You received this message because you are subscribed to the Google
> > Groups "model-glue" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<model-glue%[email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/model-glue?hl=en
>
> --
> William Osler - "We are here to add what we can to life, not to get what we
> can from life."

-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
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/model-glue?hl=en

-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
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/model-glue?hl=en

Reply via email to