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
Fields inherited from class org.elasticsearch.rest.action.RestActionListener
channel
-
Constructor Summary
ConstructorDescriptionRestToXContentListener
(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
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, delegateFailureAndWrap, 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: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 ToXContentObject>
- Throws:
Exception
-