info.magnolia.cms.beans.config
Class MIMEMapping

java.lang.Object
  extended by info.magnolia.cms.beans.config.MIMEMapping

public class MIMEMapping
extends Object

Manages mappings of file extensions with their MIME types and icon.


Nested Class Summary
protected static class MIMEMapping.MIMEMappingItem
          Used to keep the configuration in memory.
 
Field Summary
static String DEFAULT_ICON
           
static String DEFAULT_ICON_STYLE
           
static String ICONS_PATH
           
 
Method Summary
static String getContentEncoding(String contentType)
           
static String getContentEncodingOrDefault(String contentType)
           
static String getMIMEType(String key)
          Get MIME type String.
static String getMIMETypeIcon(String extension)
          Returns the icon used for rendering this type.
static String getMIMETypeIconStyle(String mimeType)
          Returns the icon css style name.
static String getMIMETypeOrDefault(String extension)
          Returns the mime-type associated with this extension, or the server's default.
static void init()
          Reads all configured mime mapping (config/server/MIMEMapping).
static void load()
          Reads all configured mime mapping (config/server/MIMEMapping).
static void reload()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ICONS_PATH

public static final String ICONS_PATH
See Also:
Constant Field Values

DEFAULT_ICON

public static final String DEFAULT_ICON
See Also:
Constant Field Values

DEFAULT_ICON_STYLE

public static final String DEFAULT_ICON_STYLE
See Also:
Constant Field Values
Method Detail

init

public static void init()
Reads all configured mime mapping (config/server/MIMEMapping).


load

public static void load()
Reads all configured mime mapping (config/server/MIMEMapping).


reload

public static void reload()

getMIMEType

public static String getMIMEType(String key)
Get MIME type String.

Parameters:
key - extension for which MIME type is requested
Returns:
MIME type

getMIMETypeOrDefault

public static String getMIMETypeOrDefault(String extension)
Returns the mime-type associated with this extension, or the server's default.


getContentEncoding

public static String getContentEncoding(String contentType)

getContentEncodingOrDefault

public static String getContentEncodingOrDefault(String contentType)

getMIMETypeIcon

public static String getMIMETypeIcon(String extension)
Returns the icon used for rendering this type.

Returns:
the icon name

getMIMETypeIconStyle

public static String getMIMETypeIconStyle(String mimeType)
Returns the icon css style name.

Returns:
icon css style name.


Copyright © 2003-2014 Magnolia International Ltd.. All Rights Reserved.