pygmy.handlers
Class DefaultChainHandler

java.lang.Object
  extended by pygmy.core.AbstractHandler
      extended by pygmy.handlers.DefaultChainHandler
All Implemented Interfaces:
Handler

public class DefaultChainHandler
extends AbstractHandler
implements Handler

This is the default implementation of a chain of handlers. The .chain parameter defines the names of the handlers in the chain, and it defines the order in which those handlers will be called. Each handler name is seperated by either a ' ' (space) or a ',' (comma). This handler will then try to create a handler for each of the handler names by looking at configuration property {handler-name}.class. This handler also has a .url-prefix parameter it uses to know when this handler should pass the request to the chain.

Parameter NameExplanationDefault ValueRequired
url-prefixThe prefix to filter request urls.NoneYes
chainA space or comma seperated list of the names of the handlers within the chain.NoneYes
classFor each of the names in the chain property, this is appended the name to find the classname to instatiate.NoneYes


Field Summary
static java.lang.String CHAIN
           
static ConfigOption CHAIN_OPTION
           
 
Fields inherited from class pygmy.core.AbstractHandler
handlerName, server, URL_PREFIX_OPTION, urlPrefix
 
Constructor Summary
DefaultChainHandler()
           
 
Method Summary
 boolean handle(Request request, Response response)
           
 boolean initialize(java.lang.String handlerName, Server server)
           
 boolean shutdown(Server server)
           
 
Methods inherited from class pygmy.core.AbstractHandler
getMimeType, getName, getUrlPrefix, handleBody, isRequestdForHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface pygmy.core.Handler
getName
 

Field Detail

CHAIN

public static java.lang.String CHAIN

CHAIN_OPTION

public static final ConfigOption CHAIN_OPTION
Constructor Detail

DefaultChainHandler

public DefaultChainHandler()
Method Detail

initialize

public boolean initialize(java.lang.String handlerName,
                          Server server)
Specified by:
initialize in interface Handler
Overrides:
initialize in class AbstractHandler

handle

public boolean handle(Request request,
                      Response response)
               throws java.io.IOException
Specified by:
handle in interface Handler
Overrides:
handle in class AbstractHandler
Throws:
java.io.IOException

shutdown

public boolean shutdown(Server server)
Specified by:
shutdown in interface Handler
Overrides:
shutdown in class AbstractHandler