org.erowid.sperowider
Class HandlerPool

java.lang.Object
  extended byorg.erowid.sperowider.HandlerPool

public class HandlerPool
extends Object

A pool of AHandler objects, and a map from MIME types and file extensions to those objects.

Version:
: $Header: /cvsroot/sperowider/SPEROWIDER_MODULE/javasource/org/erowid/sperowider/HandlerPool.java,v 1.10 2005/01/15 23:26:15 gurustu Exp $
Author:
: $Author: gurustu $

Constructor Summary
HandlerPool(SperowiderContext context)
          Creates a new HandlerPool object, and creates some basic mappings : text/html maps to TextHtmlHandler text/css maps to TextCssHandler application/x-javascript maps to PatternMatchingHandler .html maps to TextHtmlHandler .css maps to TextCssHandler .js maps to PatternMatchingHandler It also creates the default handler, which is used for unrecognized MIME types and file extensions.
 
Method Summary
 void addHandler(String mimetype, String fileExtension, String className)
          Adds a new AHandler to the pool, mapped to a specific MIME type and file extension.
 void addHandlerForFileExtension(String fileExtension, AHandler handler)
          Adds a new AHandler, mapped to a specific file extension.
 void addHandlerForFileExtension(String fileExtension, String className)
          Adds a new AHandler, mapped to a specific file extension.
 void addHandlerForMimeType(String mimetype, AHandler handler)
          Adds a new AHandler, mapped to a specific MIME type.
 void addHandlerForMimeType(String mimetype, String className)
          Adds a new AHandler, mapped to a specific MIME type.
 AHandler getDefaultHandler()
          Returns the default handler, the AHandler that will be used for unrecognized MIME types and file extensions.
 AHandler getHandlerForFileExtension(String fileExtension)
          Returns an AHandler for the passed in file extension.
 AHandler getHandlerForMimeType(String mimetype)
          Returns an AHandler for the passed in MIME type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HandlerPool

public HandlerPool(SperowiderContext context)
            throws SperowiderInstantiationException
Creates a new HandlerPool object, and creates some basic mappings : It also creates the default handler, which is used for unrecognized MIME types and file extensions. The default handler is GenericHandler.

Method Detail

addHandler

public void addHandler(String mimetype,
                       String fileExtension,
                       String className)
                throws ClassNotFoundException,
                       IllegalAccessException,
                       SperowiderInstantiationException
Adds a new AHandler to the pool, mapped to a specific MIME type and file extension.

Throws:
ClassNotFoundException
IllegalAccessException
SperowiderInstantiationException

addHandlerForMimeType

public void addHandlerForMimeType(String mimetype,
                                  AHandler handler)
Adds a new AHandler, mapped to a specific MIME type.


addHandlerForFileExtension

public void addHandlerForFileExtension(String fileExtension,
                                       AHandler handler)
Adds a new AHandler, mapped to a specific file extension.


addHandlerForMimeType

public void addHandlerForMimeType(String mimetype,
                                  String className)
                           throws Exception
Adds a new AHandler, mapped to a specific MIME type.

Throws:
Exception

addHandlerForFileExtension

public void addHandlerForFileExtension(String fileExtension,
                                       String className)
                                throws Exception
Adds a new AHandler, mapped to a specific file extension.

Throws:
Exception

getHandlerForFileExtension

public AHandler getHandlerForFileExtension(String fileExtension)
Returns an AHandler for the passed in file extension.


getHandlerForMimeType

public AHandler getHandlerForMimeType(String mimetype)
Returns an AHandler for the passed in MIME type.


getDefaultHandler

public AHandler getDefaultHandler()
Returns the default handler, the AHandler that will be used for unrecognized MIME types and file extensions.


spero logo small Sperowider is
© 2005 Erowid.org