I'm trying to set up a pajax organisation within my sf2 project. The
aim is : if request has a P-AJAX header, then set RequestFormat to
htmlRaw (for instance), but _before_ the route matching.

I mean, I want to define in my routes if the htmlRaw format is allowed
or not. So if the P-AJAX header is set but my route says requirements:
_format: html|xml, I want the route engine to throw a 404 exception.

I tried to set up an onCoreRequest listener with something like that:
if( $event->getRequest()->headers->has('P-AJAX') AND $event-
>getRequest()->headers->get('P-AJAX') )
{
        $event->getRequest()->setRequestFormat('htmlRaw');
}
It's actually executed before the route engine, but the htmlRaw format
passes route requirements even if it's should not.

So how to get things done in the right way? I could, but don't want to
throw the 404 exception elsewhere in my code (controller,
listener, ..) as the role engine is the only one to know which format
is allowed, and because it's its role.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to