But it's not clear to me why this code should use the
"MetadataService" at all.  The mapping of file extensions to
MediaTypes is one of the web's irritating but hard to avoid dirty
shameful secrets.  The only time we should stoop so low as to base a
MediaType calculation on an extension name is if we have no other
choice- in fact, we only have to do this when we DONT have real
metadata available!

If I am writing a restful web service, and I want to deliver a
representation with a mediatype of "image/jpeg", then that's what I
should have to put in the @Get annotation- not "jpg" or "jpeg" or
"JPG" or any other of the random 3 or 4-letter filename extensions
that someone, somewhere, sometime happened to associate (in their
anemic filesystem) with that mediatype.

(If I sound grumpy it might be because I just spent quite a while with
a debugger trying to figure out why my new ServerResource subclass
wasn't working, and it turns out it's because I was using "text/html"
instead of "htm" or whatever. :-) )

So, I vote for explicit mediatypes.  and maybe we also need to be able
to specify charsets too?   Hmm, maybe that's not useful for content
negotiation, not sure.

-Dave Fogel

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1528590

Reply via email to