2009年11月24日星期二

[fw-mvc] Problems with chained routes on XMLHTTP requests

Hello,

I am experiencing some problems with chained routes on xmlhttp requests. I don't have much experience with chained routes.

I have one page which loads by an xmlhttp request some info from the same url as the "parent" page. Page to route is: http://www.domain/admin/navigationmenus/displayall

The page itself is routing fine, to the default route. But... On xmlhttp request the routing process is actually selecting the defaulth route instead....

Here are the headers differences sent for normal request:
Accept    text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Cache-Control    max-age=0

On xmlhttp request:
Content-Type    application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With    XMLHttpRequest
Referer    http://www.domain/admin/navigationmenus/displayall
Content-Length    65
Pragma    no-cache
Cache-Control    no-cache

My routes:
resources.router.routes.defaulth.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.defaulth.route = ":topic.domain"
resources.router.routes.defaulth.defaults.topic = www
;resources.router.routes.defaulth.abstract = "true"

resources.router.routes.defaultp.type = "Zend_Controller_Router_Route"
resources.router.routes.defaultp.route = ":module/:controller/:action/*"
resources.router.routes.defaultp.defaults.module = default
resources.router.routes.defaultp.defaults.controller = index
resources.router.routes.defaultp.defaults.action = index
resources.router.routes.defaultp.abstract = "true"

resources.router.routes.resourcesp.type = "Zend_Controller_Router_Route"
resources.router.routes.resourcesp.route = ":controller/:id"
resources.router.routes.resourcesp.defaults.module = resources
resources.router.routes.resourcesp.defaults.action = view
resources.router.routes.resourcesp.reqs.controller = "articles|news"
resources.router.routes.resourcesp.defaults.id = 0
resources.router.routes.resourcesp.abstract = "true"

resources.router.routes.default.type = Zend_Controller_Router_Route_Chain
resources.router.routes.default.chain = "defaulth, defaultp"

resources.router.routes.resource.type = Zend_Controller_Router_Route_Chain
resources.router.routes.resource.chain = "defaulth, resourcesp"

Anyone, any idea why on the second request (xmlhttp) that's selected a different route than on normal request ?

--  Best regards, Cristian Bichis www.zftutorials.com | www.zfforums.com | www.zftalk.com | www.zflinks.com

没有评论: