stop delivering static MIME-type data

2008-09-27 @ 12:33#

when a client asks for a resource representation from your server, it's a mistake to offer that representation in only one MIME-type. there are lots of clients; lots of ways to use data. make sure your Web content is available in multiple MIME-types. and make sure you actually pay attention to the request from the client and provide the MIME-type the client requests.

presentation, data, syndication

your content should be available in at least one fully-formed 'presentation type' (HTML, PDF, Plain Text) and at least one 'data type' (XML, JSON, RDF, etc.). it's also an excellent idea to offer your data in at least one 'syndication type' (RSS, Atom, etc.). when you do this, clients can leverage your data in lots of cool ways. when you fail to do this, clients are stuck taking your data 'as-is' and are dependent on you to figure out what can be done w/ the data.

content-type & accept

finally, learn the proper way determine the MIME-type the client is looking for. stop trying to link MIME-types to 'file tails' on the URL (.html, .aspx, .rss09). instead learn to use the Content-Type and Accept HTTP headers that the client *always* sends to the server. yes, that means you need a decent server-side content-negotiation algorithm. that's not evil. that's not scary. that's just a bit of work to do.

so get to work and start delivering an array of representations of your resources.

code