org.baswell.routes
Enum MediaType

java.lang.Object
  extended by java.lang.Enum<MediaType>
      extended by org.baswell.routes.MediaType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<MediaType>

public enum MediaType
extends java.lang.Enum<MediaType>

Media types that Routes is aware of. A media type has one or more mime types and one more file extensions.

See Also:
Route.respondsToMediaRequests(), RequestedMediaType.mediaType

Enum Constant Summary
ATOM
           
CSV
           
EXCEL
           
HTML
           
ICS
           
JAVASCRIPT
           
JSON
           
PDF
           
RSS
           
TEXT
           
WORD
           
XML
           
 
Field Summary
 java.lang.String extension
          The default file extension.
 java.util.List<java.lang.String> extensions
          All file extensions.
 java.lang.String mimeType
          The default mime type.
 java.util.List<java.lang.String> mimeTypes
          All mime types.
 
Method Summary
static MediaType findFromExtension(java.lang.String extension)
           
static MediaType findFromMediaTypeParameter(java.lang.String mediaTypeParameter)
           
static MediaType findFromMimeType(java.lang.String mimeTypes)
           
static MediaType valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static MediaType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ATOM

public static final MediaType ATOM

CSV

public static final MediaType CSV

EXCEL

public static final MediaType EXCEL

HTML

public static final MediaType HTML

ICS

public static final MediaType ICS

JAVASCRIPT

public static final MediaType JAVASCRIPT

JSON

public static final MediaType JSON

PDF

public static final MediaType PDF

RSS

public static final MediaType RSS

TEXT

public static final MediaType TEXT

WORD

public static final MediaType WORD

XML

public static final MediaType XML
Field Detail

mimeType

public final java.lang.String mimeType
The default mime type.


mimeTypes

public final java.util.List<java.lang.String> mimeTypes
All mime types.


extension

public final java.lang.String extension
The default file extension.


extensions

public final java.util.List<java.lang.String> extensions
All file extensions.

Method Detail

values

public static MediaType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (MediaType c : MediaType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static MediaType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

findFromMimeType

public static MediaType findFromMimeType(java.lang.String mimeTypes)
Parameters:
mimeTypes - A comma delimitted list of mime types
Returns:
The MediaType that has a matching mime type or null.

findFromExtension

public static MediaType findFromExtension(java.lang.String extension)
Parameters:
extension - The file extension
Returns:
The MediaType that has a matching file extension or null.

findFromMediaTypeParameter

public static MediaType findFromMediaTypeParameter(java.lang.String mediaTypeParameter)
Parameters:
mediaTypeParameter - The media type parameter
Returns:
The MediaType that has the same name as the format parameter (ex. mediaType=json) or null.