And aside from formats, even with HTML, I'm likely going to want to redirect after a normal form submission, but not after an ajax form submission. Practically, it seems that only one situation (html + non-ajax) really needs a redirect, but having the redirect in the controller codes for that one situation. Having a redirect in the controller of a bundle - regardless of how Symfony2 is coded - seems like a fail. Somehow, that redirect needs to be handled in such a way that the end-developer can choose to "override" it use the controller's to render any other situation (html+ajax, json) that won't require a redirect.
You can see the above-issue in symfony1 via the sfDoctrineGuardPlugin. The sfGuardAuth/signin action cannot be used effectively with ajax because it has the redirect in the middle of the action. ( http://trac.symfony-project.org/browser/plugins/sfDoctrineGuardPlugin/trunk/modules/sfGuardAuth/lib/BasesfGuardAuthActions.class.php ) Ryan Weaver Lead Programmer - iostudio - Nashville, TN http://www.iostudio.com http://www.thatsquality.com Twitter: @weaverryan On Sat, Oct 30, 2010 at 2:53 PM, Lukas Kahwe Smith <[email protected]>wrote: > On 30.10.2010, at 19:26, "Leo \"Ekinox\" Gaspard" <[email protected]> > wrote: > > > > > > > Le 30/10/2010 14:54, Lukas Kahwe Smith a écrit : > >> > >> On 30.10.2010, at 14:52, Miha Vrhovnik wrote: > >> > >>> Why redirect with html meta tag and not 302 HTTP code, which is the > >>> right choice? > >> > >> > >> it also does that. plus the html code is changed in dev mode too. > > > > And why doesn't it just uses php's header('Location: %s') followed by an > exit() to do this ? So JSON clients would automagically follow the redirect, > isn't it ? > > it does all of that. check the code in the response class. the magic for > the dev mode is somewhere else iirc. > > but thats all beside the point. the main use of redirect is to prevent > duplicate submissions with forms. and thats simply not a problem with json > requests. you dont want to do another round trip in that case. > > regards > Lukas > > -- > 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 developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<symfony-devs%[email protected]> > For more options, visit this group at > http://groups.google.com/group/symfony-devs?hl=en > -- 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 developers" 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/symfony-devs?hl=en
