Package org.elasticsearch.rest.action
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).-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.action.ActionListener
ActionListener.Delegating<Response,DelegateResponse>, ActionListener.DelegatingActionListener<T>, ActionListener.DelegatingFailureActionListener<T,R>, ActionListener.MappedActionListener<Response,MappedResponse>, ActionListener.RunAfterActionListener<T>, ActionListener.RunBeforeActionListener<T> -
Field Summary
Fields inherited from class org.elasticsearch.rest.action.RestActionListener
channel -
Constructor Summary
Constructors Constructor Description RestToXContentListener(RestChannel channel) -
Method Summary
Modifier and Type Method Description RestResponsebuildResponse(Response response)Builds the response to send back through the channel.RestResponsebuildResponse(Response response, org.elasticsearch.common.xcontent.XContentBuilder builder)protected RestStatusgetStatus(Response response)Methods inherited from class org.elasticsearch.rest.action.RestResponseListener
processResponseMethods inherited from class org.elasticsearch.rest.action.RestActionListener
onFailure, onResponseMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.action.ActionListener
delegateFailure, delegateResponse, map
-
Constructor Details
-
RestToXContentListener
-
-
Method Details
-
buildResponse
Description copied from class:RestResponseListenerBuilds the response to send back through the channel.- Specified by:
buildResponsein classRestResponseListener<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
-