On 17.01.2011, at 17:11, Bulat Shakirzyanov wrote:

> Dear Symfony2 developers,
> 
> I have some thoughts about Request object.
> 
> Currently Request object is initializing itself from PHP global variables.
> However, this makes it hard to re-use the same controllers for REST
> request handling. As the $request attribute of Request object is only
> populated on a form post.
> 
> The typical html post request looks like this:
> 
> Request line
> Content-type: application/x-www-form-urlencoded
> 
> key=val&key2=val2
> 
> While a typical json REST post looks or should look like:
> 
> Request line
> Content-type: application/json
> 
> {
>     key: val,
>     key2: val2
> }
> 
> I am not gonna show an xml example here, but you get the idea.
> 
> So, from looking at all of the above, we could see, that there needs
> to be something that knows how to transform a request body string
> (be it a urlencoded key/value pairs or a json object) into a php array,
> that will become Request::$request.
> 
> We could then register those transformers based on request content
> type and provice Symfony2 default transformers so that basic REST
> requests can be handled by the same controllers as regular HTML
> ones.
> 
> We could also provide ability to overload those transformers and add
> more of user's transformers, in case they want to go full REST and
> use HATEOAS in their API, or simply in case they don't want to use
> smart defaults.
> 
> I personally would also like to make the Request object less smart
> and keep it similar to the Response one, where all the data is provided
> from the outside and only data-specific operations live inside the class.
> I would like therefore the Kernel to be responsible for request population
> but there might be gotchas, that I am not aware of.

I agree in principle.

regards,
Lukas Kahwe Smith
[email protected]



-- 
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

Reply via email to