Add rest.before and rest.after hooks

This feature is needed by LoopBack to install a `rest.after` hook converting `null` result of `findById()` to `404 Not Found` error.

The pull request has three sets of changes:
1. Improved test coverage of `RestAdapter.prototype.createHandler()`. Run `git diff --minimal -w 880059..6e8a82` for a better diff.
2. Refactoring of `createHandler()` to make it easier to add new functionality
3. Adding rest hooks, which is a small change in this stage.

/to: @raymondfeng or @ritch - please review
/cc: @Schoonology FYI

See also follow-up pull requests in other repositories: strongloop/loopback-datasource-juggler#44, strongloop/loopback#75.