[ckan-discuss] ANN: Simple Content Autonegotiation (F)CGI
William Waites
william.waites at okfn.org
Tue Oct 19 18:27:48 BST 2010
To help us do more with the filesystem and easily serve
files directly in the correct format I've written a small
CGI script. It's currently running in a testing environment
but appears to be working well.
Page is here: http://river.styx.org/ww/2010/10/autoneg/index
Documentation and source linked from there.
To see it in action, try out the following:
* curl -i http://river.styx.org/ww/2010/10/autoneg/index
* curl -i -H "Accept: text/html" http://river.styx.org/ww/2010/10/autoneg/index
* curl -i http://river.styx.org/ww/foaf
* curl -i -H "Accept: text/n3" http://river.styx.org/ww/foaf
To get the corresponding files directly, without doing content
negotiation, one would use the following URLs:
* http://river.styx.org/ww/2010/10/autoneg/index.txt
* http://river.styx.org/ww/2010/10/autoneg/index.html
* http://river.styx.org/ww/foaf.rdf
* http://river.styx.org/ww/foaf.n3
I am imagining that this could be used with, e.g. CKAN if
different renderings of the resources (e.g. HTML, JSON, RDF)
were pre-made. They could then be served in a very lightweight
manner without relying on all of the heavy web application
machinery using this simple script.
Comments, feedback, suggestions more than welcome.
Cheers,
-w
More information about the ckan-discuss
mailing list