On Mar 13, 2006, at 3:31 PM, Matthew Eernisse wrote:
> Content negotiation does on its face seem to be more
complicated,
> and a
> bit more opaque and brittle than the simplicity of
allowing explicit
> choice of content-type through the URI.
>
> The one bit of personal experience I have with this
type of thing
> is the
> responseXML property of the XHR object not getting
populated properly
> because the response from a Web service comes back with
a MIME type of
> 'application/soap+xml' instead of the expected
'application/xml' or
> 'text/xml.' A lot of people seem to get bitten by
this because the
> response coming back is clearly well-formed XML, and
the only way to
> figure out what's wrong is to know that XHR is broken
in this way and
> inspect the headers of the response.
>
> My two piastres.
>
>
The main issue I have with content negotiation is that it
requires
that clients that use it know the right stuff to put in
Accept. What
if you have some client which wants an Atom feed, but the
only way to
get an Atom feed is to use a URL like "http://cosmoserver/home
/user/
feeds" in conjunction with the proper Accept header.
If your client
doesn't know from Accept hearers and you have no way to
tell it to
use them then you are out of luck.
Whereas the URI based way you can do:
http://cosmose
rver/home/user/feeds/rss
http://cosmos
erver/home/user/feeds/atom
ht
tp://cosmoserver/home/user/feeds/someotherformat
and know just what you're getting.
I guess it's similar to the problem the author describes
where he
says "I get no chance to tweak the services Accept:
header."
Maybe you could have your cake and eat it too like this:
When doing a GET in the user's DAV home without an Accept
header,
(they're not required, right?) return the default cosmo
format for
that resource. If they specify something in Accept, respect
the
client's wishes.
In addition, have content-type-specific paths for different
feeds
and formats, and requests in those paths will only return
the one
type of format that it is intended for.
This way you get maximum interop:
1) For clients that are don't use "Accept" but
have users who know
which URI to use it works.
2) For clients that DO use "Accept" but have
users who don't
understand the difference between the different formats and
hence not
know which path to put in (or don't want to think about it)
it also
works.
Bobby
_______________________________________________
Cosmo mailing list
Cosmo osafoundation.org
http://lists.osafoundation.org/mailman/listinfo/cosmo
|