Odd behavior using SES URL's and 'urlExcludeEventParameter' property

3 views
Skip to first unread message

Jeff Lucido

unread,
Jan 25, 2010, 3:17:36 PM1/25/10
to mach-ii-for...@googlegroups.com
I am experiencing issues using the 'urlParseSES' and 'urlExcludeEventParameter' properties in M2 1.8 RC2. The issue is when I set the property to exclude the event parameter to 'true' then my URL string is not being processed as I would expect. I am hoping someone else can point out my mistake/misunderstanding concerning this process.

Specifically, take into consideration the following two URL's:

Ex. 1: http://testwebsite.local/index.cfm/event/testSES/1/?foo=bar&blow=chunks
Ex. 2: http://testwebsite.local/index.cfm/testSES/1/?foo=bar&blow=chunks

My assumption is both URL's should be processed by the framework with an event name of 'testSES' with the query string being parsed into event argument/value pairs as follows:

1 = (empty string)
foo = bar
blow = chunks
event = testSES

When I turn 'off' the 'urlExcludeEventParameter' (set to false is what I meant) I get the expected results when I dump the event arguments (confirming the above struct value). Now, turning this property to 'on' my request is sent to my default event since it appears the framework is not parsing the correct event from the URL. The dump of the event arguments on the default event page shows (this is when executing URL example #2):

foo = bar
blow = chunks
testSes = 1

Has anyone experienced this issue? Am I wrong in my assumptions as to how SES URL's and more specifically the ability to not require the event property are handled in M2? Any comments/help would be greatly appreciated.

Kind regards,
-JSLucido

Kurt Wiersma

unread,
Jan 25, 2010, 5:07:51 PM1/25/10
to mach-ii-for...@googlegroups.com
I think you have it right other then the 1 = (empty string) part. Mach
II cannot really know that is what you mean there for plain SES urls.
I think you could accomplish this using the URL Routes feature which
allows you specify defaults for each element in the URL. Have you
checked out the routes feature?

--Kurt

> --
> You received this message because you are subscribed to Mach-II for CFML
> list.
> To post to this group, send email to mach-ii-for...@googlegroups.com
> To unsubscribe from this group, send email to
> mach-ii-for-coldf...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
> SVN: http://greatbiztoolsllc.svn.cvsdude.com/mach-ii/
> Wiki / Documentation / Tickets:
> http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/

Jeff Lucido

unread,
Jan 25, 2010, 5:29:54 PM1/25/10
to mach-ii-for...@googlegroups.com
Thanks for the quick reply Kurt. No, I did not know about UrlRoutes, so I will definitely look into those.

One other example I forgot to add to my original message was the addition of one more / delimited element in the URL processes the event name properly.

Ex. 3: http://testwebsite.local/index.cfm/testSES/1/2/?foo=bar&blow=chunks

The resulting event argument struct then looks like:

1 = 2

foo = bar
blow = chunks
event = testSes

This pattern is repeated so as long as there are an odd number of '/' delimited arguments. The reason I assumed the example 2 pattern would work (from my original message) was I figured M2 parsed the first element in the cgi.path_info to get the actual event. This appears to be the case when you add the "event" parameter back into the URL string since in that case it does not matter how many name/value "pairs" can be matched in the cg.path_info (hence the reason the struct key 1 had an empty string value in example 1), yet it still parses the correct event name (testSES). Does my additional example make sense?

I guess my main issue is I would expect M2 to behave the same in processing SES URLs regardless of whether or not I indicate to ignore the event parameter. This is definitely not the case in my various tests.

Basically what I am using this for is a RESTful API interface to my application. I really do not care about the event arguments that M2 parses for me, rather I care that it gets to the correct event for processing purposes.

-JSLucido

Jeff Lucido

unread,
Jan 25, 2010, 6:02:29 PM1/25/10
to mach-ii-for...@googlegroups.com
I read the section on URL routes and I think I understood them so I thought I would give them a whirl. In trying to get to my 'testSES' event to fire, I created the following URL route definition in my config file:

        <property name="routes" type="MachII.properties.UrlRoutesProperty">
          <parameters>
            <parameter name="test">
              <struct>
                <key name="event" value="testSes" />
                <key name="urlAlias" value="test-ses" />
             </struct>
            </parameter>
          </parameters>
        </property>

If I understood the documentation on the site then 'http://testwebsite.local/index.cfm/test-ses/' should be "routed" to my event 'testSES', right? If this is the case, then I may have done something wrong since I am getting a M2 exception saying 'Event-handler for event 'test-ses' in module '' is not defined.'

Any help/feedback on where I went awry is greatly appreciated.

Kind regards,
-JSLucido
Reply all
Reply to author
Forward
0 new messages