The MetadataService is what you're talking about. It translates between strings and other useful dimensions (in this case, MediaType instances). Right now, though, it only supports "extensions" as the strings, which mean to be filename extensions. So that's why we have "txt" as the shorthand for MediaType.TEXT_PLAIN.


It seems a good idea to me to change MetadataService to support other kinds of shortcuts. In fact, as others have pointed out, it should be desirable to have the actual full MIME type as a shortcut.


-Tal


Paul Austin wrote:

An alternative would be to have a MimeType class  which had String constant values for all the common MediaTypes, then you would only need to use strings if you had a non common media type.

One other thing I've noticed that in some places the mime type is shortened (e.g. xml instead of text/xml). Is it possible to use the full mime type across the API if required?

Paul

On Thu, Apr 2, 2009 at 9:13 AM, Stephan Koops <stephan.ko...@web.de> wrote:
Stephan Koops schrieb:
> Jonathan Hall schrieb:
>
>> Shame you can't have @Get(MediaType.TEXT_HTML). I don't know.
>>
> Would it work to change MediaType from class to an enum? That could
> work, but I'm not sure

While sending the email I remembered: You can't add new MediaTypes this
way, so we could forget my previous idea.

best regards
  Stephan

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

Reply via email to