Xindice API
version 1.2m1

org.apache.xindice.webadmin.util
Class MimeTable

java.lang.Object
  extended byorg.apache.xindice.webadmin.util.MimeTable

public class MimeTable
extends Object

MimeTable maps a file extension to a mime type.

Version:
$Revision: 541515 $, $Date: 2007-05-24 22:45:06 -0400 (Thu, 24 May 2007) $
Author:
Jan Metzner

Field Summary
static String BINARY_MIME_TYPE
          the default mime type for binaries
protected static Hashtable mimeMappings
          holds the extensions/mime types
static String XML_MIME_TYPE
          the default mime type for xml documents
 
Constructor Summary
MimeTable()
           
 
Method Summary
static void addMimeConfig(org.w3c.dom.Document doc)
          Add the given mime Document to this mime table.
static void configure(String location)
          Configures the Mime table.
static String getMimeType(String resourceName)
          Returns the mime type for the given name.
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BINARY_MIME_TYPE

public static final String BINARY_MIME_TYPE
the default mime type for binaries

See Also:
Constant Field Values

XML_MIME_TYPE

public static final String XML_MIME_TYPE
the default mime type for xml documents

See Also:
Constant Field Values

mimeMappings

protected static Hashtable mimeMappings
holds the extensions/mime types

Constructor Detail

MimeTable

public MimeTable()
Method Detail

configure

public static void configure(String location)
Configures the Mime table. the configuration can look like the Configuration in the addMimeConfig(Configuration config) Method

or if the Configuration should be loaded out of an extra file:
 <mime location="/some/path">
 
or if the Configuration should be loaded out of the Classpath:
 <mime location="resource://org.a.MyFile">
 


addMimeConfig

public static void addMimeConfig(org.w3c.dom.Document doc)
Add the given mime Document to this mime table. the mime Document looks like this:
 <mime>
  <mime-mapping>
   <extension>xml</extension>
   <mime-type>xml</mime-type>
  </mime-mapping>
 ...
 </mime>
 

Parameters:
doc - mime config.

getMimeType

public static String getMimeType(String resourceName)
Returns the mime type for the given name. If no mime for this name is available the parameter defaultXml specifies if the xml mime type or the binary mime type are returned.

Parameters:
resourceName -
Returns:
mime type for this resource name

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

Xindice API
version 1.2m1

Copyright (c) 1999-2007 The Apache Software Foundation. All Rights Reserved.