If i query a XML service, i get a XML response (text/xml) - with error or data If i query a JSON service, i get a JSON response (application/json) - with error or data
Is there something to disagree? Only because there is a hack which allows transport of HTML (or whatever) along with a pure dataformat, i don't see why that should be a keeper. I personally create such fragments from JSON data, or modify the application behaviour. There is no text/html involved in that action and i belief that this is the whole purpose of JSON. If my application uses pre-generated HTML aside from JSON -in a row-, i should ask myself why i use JSON at all. Just for a 'yay or nay'?? I don't think so.. But.. it's a matter of application design after all. Generally: mixing mime is bad. - Kjell On 1/22/07, Dave Crane <[EMAIL PROTECTED]> wrote: > > On Monday 22 January 2007 15:56, Ed C. wrote: > > This seems like almost a duplication of effort -- we already have access to > > the HTTP status codes, which could (should?) be used to determine success > > (example, 200 = OK, 500 = Error). The content body includes the results or > > error message(s). > > > HTTP 500 is generally used to signal an application error somewhere in the > system (the database is down, you tried to divide by zero, and so on). > Similarly, other status codes relate to the status of the attempted HTTP > request and response (e.g. 401 = your request requires authentication). > > This is a different thing from an application error or status code e.g. 'the > object you are trying to update is a stale copy'. X-JSON can also be used for > status/update data such as 'you have three outstanding cases, here are their > names and ids', to automatically refresh a list in the background, every time > you request or update anything in your app (in which case the request body is > busy reporting something else). > > Mislav - yes, X-JSON is a hack, and an acceptable one IMO, with a good > pedigree. As you point out, multipart MIME type responses are a hack on top > of HTTP - so are CGI parameters, and sessions, if you look at what HTTP was > originally designed to do. > > Dave > > -- > ---------------------- > Author > Ajax in Action http://manning.com/crane > Ajax in Practice http://manning.com/crane2 > Prototype & Scriptaculous Quickly http://manning.com/crane3 > > > > -- Kjell -- www.m3nt0r.de --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
