[Building Sakai] A note about POSTing data to EntityBroker

Aaron Zeckoski azeckoski at unicon.net
Mon Mar 26 04:43:56 PDT 2012


On Mon, Mar 26, 2012 at 4:59 AM, Matthew Buckett
<matthew.buckett at oucs.ox.ac.uk> wrote:
>
> Just to make sure I understand correctly entitybroker decides which
> parser to use based on the extension of the URL .xml = XML .json =
> JSON?

This is one method it uses but the statement is true, just not in isolation.


> So if the URL ends .json and the content type is
> application/x-www-form-urlencoded  there is no sensible way it can
> understand the request so would it be better off throwing an error say
> you probably need to set your content type to application/json?

Not quite that easy unfortunately. The request might be simply made
from a large set of request parameters that match the fields of the
object. This is fairly common and jquery even has a shortcut to
support turning a JS object into params in an ajax request. Then the
return data from the request might be JSON.

All that said, I am guessing there are probably some very specific
cases where using content type application/x-www-form-urlencoded makes
no sense and a warning would make sense. I suggest putting together a
patch and I will be happy to review it.

-AZ



-- 
Aaron Zeckoski - Software Architect - http://tinyurl.com/azprofile


More information about the sakai-dev mailing list