I was debugging some content negotiation related issue the other day and made a little tool that allows me to find out what Accept header different RDF-aware HTTP clients send. If you ever need to know the Accept header of a particular RDF-aware HTTP client, just make it show the RDF loaded from this URI:
The RDF contains a dc:description with the browser’s Accept header. If you have the Tabulator Firefox extension installed, you can simply click the link and see the output.
I tried this with a couple of tools and here are the results:
Tabulator Firefox Extension 0.8.2:
application/rdf+xml, application/xhtml+xml;q=0.3, text/xml;q=0.2, application/xml;q=0.2, text/html;q=0.3, text/plain;q=0.1, text/n3, text/rdf+n3;q=0.5, application/x-turtle;q=0.2, text/turtle;q=1
Jena’s Model.read(…) method:
application/rdf+xml, application/xml; q=0.8, text/xml; q=0.7, application/rss+xml; q=0.3, */*; q=0.2
Disco Hyperdata Browser:
application/rdf+xml;q=1,text/xml;q=0.6,text/rdf+n3;q=0.9, application/octet-stream;q=0.5,application/xml q=0.5, application/rss+xml;q=0.5,text/plain; q=0.5,application/x-turtle;q=0.5, application/x-trig;q=0.5,text/html;q=0.5
OpenLink RDF Browser:
application/rdf+xml, text/rdf+n3, application/rdf+turtle, application/x-turtle, application/turtle, application/xml, */*
application/rdf+xml, application/xml;q=0.6, text/xml;q=0.6
Some of these are pretty funny actually, but that’s a post for another day.
In the Disco Hyperdata browser:
Is that a typo or does it actually send that?
Laurens, Disco really sends that header.
You can also use EARL to generate the report ;-)
So, does that mean that if you use say the Disco style accept parameters, you will never get a 303 redirect? I’ve tried quite a few different URIs for non-information resources, and always get a status code of 200.
In other words, if you use the Disco style, do you still need to worry about content negotiation, or is it done automaticaly?
Ian: The client just has to worry about sending an Accept header that matches its preferences and capabilities. The actual content negotiation, as well as the choice wether a redirect is sent, is always made by the server, so clients don’t really have to worry about it.
If you see only 200 response codes, then your client probably just doesn’t tell you about any redirects that were performed before it arrived at the final 200. See my little cURL tutorial for more information.
Nice topic on Content Negotiation, it would really help a lot