Module org.elasticsearch.server
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.RestBuilderListener<Response>
org.elasticsearch.rest.action.RestToXContentListener<Response>
- All Implemented Interfaces:
ActionListener<Response>
public class RestToXContentListener<Response extends ToXContentObject>
extends RestBuilderListener<Response>
A REST based action listener that requires the response to implement
ToXContentObject and automatically
builds an XContent based response.-
Field Summary
FieldsFields inherited from class org.elasticsearch.rest.action.RestActionListener
channel -
Constructor Summary
ConstructorsConstructorDescriptionRestToXContentListener(RestChannel channel) RestToXContentListener(RestChannel channel, Function<Response, RestStatus> statusFunction) RestToXContentListener(RestChannel channel, Function<Response, RestStatus> statusFunction, Function<Response, String> locationFunction) -
Method Summary
Modifier and TypeMethodDescriptionbuildResponse(Response response, XContentBuilder builder) Builds a response to send back over the channel.Methods inherited from class org.elasticsearch.rest.action.RestBuilderListener
buildResponseMethods inherited from class org.elasticsearch.rest.action.RestResponseListener
processResponseMethods inherited from class org.elasticsearch.rest.action.RestActionListener
ensureOpen, 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, delegateFailureAndWrap, delegateFailureIgnoreResponseAndWrap, delegateResponse, map, safeMap
-
Field Details
-
statusFunction
-
-
Constructor Details
-
RestToXContentListener
-
RestToXContentListener
-
RestToXContentListener
public RestToXContentListener(RestChannel channel, Function<Response, RestStatus> statusFunction, Function<Response, String> locationFunction)
-
-
Method Details
-
buildResponse
Description copied from class:RestBuilderListenerBuilds a response to send back over the channel. Implementors should ensure that they close the providedXContentBuilderusing theXContentBuilder.close()method.- Specified by:
buildResponsein classRestBuilderListener<Response extends ToXContentObject>- Throws:
Exception
-