Class RestToXContentListener<Response extends org.elasticsearch.common.xcontent.ToXContentObject>

All Implemented Interfaces:
ActionListener<Response>
Direct Known Subclasses:
RestStatusToXContentListener

public class RestToXContentListener<Response extends org.elasticsearch.common.xcontent.ToXContentObject> extends RestBuilderListener<Response>
A REST based action listener that requires the response to implement ToXContentObject and automatically builds an XContent based response.
  • Constructor Details

    • RestToXContentListener

      public RestToXContentListener(RestChannel channel)
  • Method Details

    • buildResponse

      public RestResponse buildResponse(Response response, org.elasticsearch.common.xcontent.XContentBuilder builder) throws Exception
      Description copied from class: RestBuilderListener
      Builds a response to send back over the channel. Implementors should ensure that they close the provided XContentBuilder using the XContentBuilder.close() method.
      Specified by:
      buildResponse in class RestBuilderListener<Response extends org.elasticsearch.common.xcontent.ToXContentObject>
      Throws:
      Exception
    • getStatus

      protected RestStatus getStatus(Response response)