Package org.elasticsearch.rest.action
Class RestToXContentListener<Response extends 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 ToXContentObject> extends RestResponseListener<Response>
A REST based action listener that assumes the response is of typeToXContent
and automatically builds an XContent based response (wrapping the toXContent in startObject/endObject).
-
-
Field Summary
-
Fields inherited from class org.elasticsearch.rest.action.RestActionListener
channel
-
-
Constructor Summary
Constructors Constructor Description RestToXContentListener(RestChannel channel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RestResponse
buildResponse(Response response)
Builds the response to send back through the channel.RestResponse
buildResponse(Response response, XContentBuilder builder)
protected RestStatus
getStatus(Response response)
-
Methods inherited from class org.elasticsearch.rest.action.RestResponseListener
processResponse
-
Methods inherited from class org.elasticsearch.rest.action.RestActionListener
onFailure, onResponse
-
-
-
-
Constructor Detail
-
RestToXContentListener
public RestToXContentListener(RestChannel channel)
-
-
Method Detail
-
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 classRestResponseListener<Response extends ToXContentObject>
- Throws:
java.lang.Exception
-
buildResponse
public RestResponse buildResponse(Response response, XContentBuilder builder) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getStatus
protected RestStatus getStatus(Response response)
-
-