elasticsearch/elasticsearch — pull request #6464 by javanna (2014-06-11 12:46:24+00:00)
Title: Transport: copied over REST headers from RestRequest to TransportRequest

Made sure that the REST headers are copied over from each `RestRequest` to the related `TransportRequest`(s).

Introduced new base class (`BaseActionRequestRestHandler`) for all the REST actions that map to a single `TransportRequest` (most of them). Split the existing `handleRequest` method in two phases: 1) request creation 2) request execution. Between the two we can automatically copy the headers to the transport request in the base class so we don't have to do it manually all the time.

Also added a utility method to copy the headers in `BaseRestHandler`, to be used by all the actions that don't extend the newly introduced `BaseActionRequestRestHandler` (e.g. cat api as each `RestRequest` maps to multiple `TransportRequest`s).

The following changes have been made as well:
1) split benchmark actions into different RestAction classes (submit, abort, status)
2) modified a couple of actions that were doing some validation during transport request creation to throw `ActionRequestValidationException` instead of directly sending the error through the channel (`RestGetSourceAction` and `RestIndexAction`)