dsto.dfc.net
Class DfcContentHandlerFactory

java.lang.Object
  extended by dsto.dfc.net.DfcContentHandlerFactory
All Implemented Interfaces:
ContentHandlerFactory

public class DfcContentHandlerFactory
extends Object
implements ContentHandlerFactory

A generic URL ContentHandlerFactory that allows handlers to dynamically associated with their MIME type.

NOTE: Use DfcFileNameMap to map URL's by their file extensions to a given MIME type.

Version:
$Revision$
Author:
Matthew Phillips

Constructor Summary
DfcContentHandlerFactory()
           
 
Method Summary
 ContentHandler createContentHandler(String mimeType)
           
static void registerFactory()
          Register this class as the system-wide content handler factory.
static void registerHandler(String mimeType, String handlerPkg, ContentHandler handler)
          Register a handler with a MIME type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DfcContentHandlerFactory

public DfcContentHandlerFactory()
Method Detail

registerFactory

public static void registerFactory()
                            throws Error
Register this class as the system-wide content handler factory.

Throws:
Error - if something else is already registered as the system content handler factory.

registerHandler

public static void registerHandler(String mimeType,
                                   String handlerPkg,
                                   ContentHandler handler)
Register a handler with a MIME type.

Parameters:
mimeType - The MIME type.
handlerPkg - The base package of the handler class, minus the major.minor part. Eg if handler is dfc.handlers.text.plain, handlerPkg should be dfc.handlers. This package is added to the system-wide handlers property.
handler - The handler for the given MIME type.

createContentHandler

public ContentHandler createContentHandler(String mimeType)
Specified by:
createContentHandler in interface ContentHandlerFactory


Copyright © 2008 Commonwealth of Australia