Since very many RESTful URLs do not have an extension, you should/must base on Content-Type
edit: I don't mean this to sound as harsh as it does, more that you're going to have to pay attention to content-type and won't always be able to refer to extension