Package org.elasticsearch.rest.action
Class RestToXContentListener<Response extends org.elasticsearch.xcontent.ToXContentObject>
java.lang.Object
org.elasticsearch.rest.action.RestActionListener<Response>
org.elasticsearch.rest.action.RestResponseListener<Response>
org.elasticsearch.rest.action.RestBuilderListener<Response>
org.elasticsearch.rest.action.RestToXContentListener<Response>
- All Implemented Interfaces:
ActionListener<Response>
- Direct Known Subclasses:
RestStatusToXContentListener
public class RestToXContentListener<Response extends org.elasticsearch.xcontent.ToXContentObject>
extends RestBuilderListener<Response>
A REST based action listener that requires the response to implement
ToXContentObject
and automatically
builds an XContent based response.-
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
-
Method Summary
Modifier and TypeMethodDescriptionbuildResponse
(Response response, org.elasticsearch.xcontent.XContentBuilder builder) Builds a response to send back over the channel.protected RestStatus
Methods inherited from class org.elasticsearch.rest.action.RestBuilderListener
buildResponse
Methods inherited from class org.elasticsearch.rest.action.RestResponseListener
processResponse
Methods inherited from class org.elasticsearch.rest.action.RestActionListener
ensureOpen, onFailure, onResponse
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.action.ActionListener
delegateFailure, delegateResponse, map
-
Constructor Details
-
RestToXContentListener
-
-
Method Details
-
buildResponse
public RestResponse buildResponse(Response response, org.elasticsearch.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 providedXContentBuilder
using theXContentBuilder.close()
method.- Specified by:
buildResponse
in classRestBuilderListener<Response extends org.elasticsearch.xcontent.ToXContentObject>
- Throws:
Exception
-
getStatus
-