[Coldbox 3.1] SES Route Execution in Modules

76 views
Skip to first unread message

Nolan Dubeau

unread,
May 22, 2012, 10:33:38 PM5/22/12
to col...@googlegroups.com
Hey folks,

I'm working on a new module and am having an issue with SES route execution. 
My module name is 'products'  and I generated it using the ColdBox Builder extension.  I have also added the following to my host application routes:  

addModuleRoutes(pattern="products",module="products");

All is good and I can access the module entry point by:

http://local.myapp.com/products:home/index

or 

http://local.myapp.com/products

In my Home.cfc handler I have two functions -  index() and add().  Both of these execute when I access like so:

http://local.myapp.com/products:home/index
http://local.myapp.com/products:home/add

According to the SES Default Route execution docs on the wiki - http://wiki.coldbox.org/wiki/Modules.cfm  I should be able to access the add() method by:

http://local.myapp.com/products/add

however, this fires just takes me to the index function and I see the following the tracer log:

Invalid Module Event Called: products:add.index. The module: products is not valid. Valid Modules are: partners,products

This is what I have for route definitions within my ModuleConfig.cfc

routes = [

// Module Entry Point
{pattern="/", handler="Home",action="index"},

// Convention Routes
{pattern="/:handler/:action?"}

];

Any idea why I can't resolve  /products/add/ ?  The docs indicate that this should work.

Thanks.

Nolan


Andrew Scott

unread,
May 22, 2012, 11:36:54 PM5/22/12
to col...@googlegroups.com
You still need the handler name.



-- 
Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/

--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to col...@googlegroups.com
To unsubscribe from this group, send email to coldbox-u...@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org



--
Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/


Nolan Dubeau

unread,
May 22, 2012, 11:56:52 PM5/22/12
to col...@googlegroups.com
Thanks Andrew.  I was able to get that to work.

That creates a bit of a messy SES URL.  i.e

http://local.myapp.com/products/home/add   ...  with home being the name of the handler.  in my mind though, the name of the module - products - is routed to the entry point products:home.index , therefore you would think that  products/add would map to the same entry point and an action function called add.  

I was able to get /products/add to work by adding this module route:

routes = [

// Module Entry Point

{pattern="/", handler="Home",action="index"},

{pattern="/add", handler="Home",action="add"},

// Convention Route

{pattern="/:handler/:action?"}

];

to me it seems like something like products/add should just work by convention given the entry point is effectively products/index.


Thanks.

Nolan

Andrew Scott

unread,
May 23, 2012, 12:43:44 AM5/23/12
to col...@googlegroups.com
No you are right, but the thing is that the default

{pattern="/:handler/:action?"} 

is probably kicking in.


-- 
Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/


Reply all
Reply to author
Forward
0 new messages