pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.util
Class MimeMap

java.lang.Object
  extended by org.torweg.pulse.configuration.AbstractConfigBean
      extended by org.torweg.pulse.util.MimeMap
All Implemented Interfaces:
java.io.Serializable, ConfigBean

public final class MimeMap
extends AbstractConfigBean

a mapping of file extensions to MIME types.

Version:
$Revision: 1405 $
Author:
Thomas Weber
See Also:
Serialized Form

Field Summary
static java.lang.String UNKNOWN_MIME_TYPE
          the MIME-type used for unknown MIME-types.
 
Constructor Summary
MimeMap()
          Deprecated. 
 
Method Summary
static MimeMap getInstance()
          gives access to an initialised MimeMap.
 java.lang.String getMimeType(java.io.File f)
          returns the MIME-type for the given file.
 java.lang.String getMimeType(java.lang.String fileName)
          returns the MIME-type for the given file name.
 java.lang.String getMimeType(java.net.URI uri)
          returns the MIME-type for the given URI.
 java.lang.String getMimeType(VirtualFile f)
          returns the MIME-type for the given file.
 java.lang.String getMimeTypeByExtension(java.lang.String ext)
          returns the MIME-type for the given extension.
 void init(org.jdom.Element conf)
          initialises the MimeMap from XML.
 
Methods inherited from class org.torweg.pulse.configuration.AbstractConfigBean
buildClass, buildInstance, lastModified, setLastModified
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN_MIME_TYPE

public static final java.lang.String UNKNOWN_MIME_TYPE
the MIME-type used for unknown MIME-types.

See Also:
Constant Field Values
Constructor Detail

MimeMap

@Deprecated
public MimeMap()
Deprecated. 

creates a new, uninitialised MimeMap. Do not use this constructor!

To get a working instance of MimeMap use getInstance().

Method Detail

getMimeTypeByExtension

public java.lang.String getMimeTypeByExtension(java.lang.String ext)
returns the MIME-type for the given extension.

If the MIME-type is unknown, it will return

Parameters:
ext - the extension
Returns:
the MIME-type

getMimeType

public java.lang.String getMimeType(java.net.URI uri)
returns the MIME-type for the given URI.

Parameters:
uri - the URI
Returns:
the MIME-type

getMimeType

public java.lang.String getMimeType(java.io.File f)
returns the MIME-type for the given file.

Parameters:
f - the file
Returns:
the MIME-type

getMimeType

public java.lang.String getMimeType(java.lang.String fileName)
returns the MIME-type for the given file name.

Parameters:
fileName - the file name
Returns:
the MIME-type

getMimeType

public java.lang.String getMimeType(VirtualFile f)
returns the MIME-type for the given file.

Parameters:
f - the file
Returns:
the MIME-type

init

public void init(org.jdom.Element conf)
initialises the MimeMap from XML.

Parameters:
conf - the configuration XML
See Also:
ConfigBean.init(org.jdom.Element)

getInstance

public static MimeMap getInstance()
gives access to an initialised MimeMap.

Returns:
an initialised MimeMap