spumko/hapi — pull request #1511 by taztwister (2014-03-24 03:42:39+00:00)
Title: Closes - 1385 - Allow plugins to register handler types

### Issue:
Closes - #1385
### Description:
This branch is to close issue 1385 - Allow plugins to register handler types

### Change Summary:
New handlers types can be defined, and built in handler types like Directory, Proxy, Views, and File can be over ridden with new definitions. Schemas for handlers can also now be defined with new functions.

### New Functionality:
The Refrence.md was updated with 4 new methods. Please refer to the docs of this branch to see the description of the 4 new functions listed here.

##### `server.handler(name, method, [schema])`

##### `server.handlerSchema(name, schema)`

##### `plugin.handler(name, method, [schema])`

##### `plugin.handlerSchema(name, schema)`

### Considerations:
1. No schema is required to be defined for a new handler type being defined. This can cause issues with unchecked malformed handler options when defining routes.

2. If a new handler overwrites a built in schema, e.g. proxy, but doesn't define a new schema to match, it will cause errors. However this does allow the code to write a new definition of how proxy will be handled and not have to define the same schema if the same schema is desired.

3. There is a concern that multiple plugins could define the same handler types and overwrite each other unintentionally. Possibly consider adding a mechanism to check for this, and also possibly a mechanism to define handler types with a flag to determine if they are allowed to be overwritten or not.