javagwtmime-typescontent-typeguava

Interface/enum listing standard mime-type constants


I am looking among the standard libraries (like apache commons, jax, jboss, javax) for an interface or enum that lists the values of all the standard mime-type (aka content-type).

This interface should not be encumbered with too deep with other classes that would make it difficult to include the whole bunch as gwt source code.

for example

interface ContentType{
  String JSON = "Application/JSON";
  blah ... blah ...
}

or,

enum ContentType{
  JSON("Application/JSON"),
  blah ... blah ...
}

Solution

  • Guava library

    We have a Guava class for this: com.google.common.net.MediaType.

    It was released with Guava 12 as stated in the source code and in Issue 823. Sources are available, too.