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

java.lang.Object
org.elasticsearch.rest.action.RestActionListener<Response>
org.elasticsearch.rest.action.RestResponseListener<Response>
org.elasticsearch.rest.action.RestToXContentListener<Response>
All Implemented Interfaces:
ActionListener<Response>
Direct Known Subclasses:
RestStatusToXContentListener

public class RestToXContentListener<Response extends org.elasticsearch.common.xcontent.ToXContentObject>
extends RestResponseListener<Response>
A REST based action listener that assumes the response is of type ToXContent and automatically builds an XContent based response (wrapping the toXContent in startObject/endObject).
  • Constructor Details

    • RestToXContentListener

      public RestToXContentListener​(RestChannel channel)
  • Method Details

    • buildResponse

      public final RestResponse buildResponse​(Response response) throws java.lang.Exception
      Description copied from class: RestResponseListener
      Builds the response to send back through the channel.
      Specified by:
      buildResponse in class RestResponseListener<Response extends org.elasticsearch.common.xcontent.ToXContentObject>
      Throws:
      java.lang.Exception
    • buildResponse

      public RestResponse buildResponse​(Response response, org.elasticsearch.common.xcontent.XContentBuilder builder) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • getStatus

      protected RestStatus getStatus​(Response response)