java.lang.Object
org.elasticsearch.rest.RestResponse
- All Implemented Interfaces:
Closeable,AutoCloseable,Releasable
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRestResponse(RestChannel channel, Exception e) RestResponse(RestChannel channel, RestStatus status, Exception e) RestResponse(RestStatus status, String content) Creates a new plain text response.RestResponse(RestStatus status, String responseMediaType, String content) Creates a new plain text response.RestResponse(RestStatus status, String responseMediaType, BytesReference content) RestResponse(RestStatus status, XContentBuilder builder) Creates a new response based onXContentBuilder. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a custom header.static RestResponsechunked(RestStatus restStatus, ChunkedRestResponseBodyPart content, Releasable releasable) voidclose()content()voidfilterHeaders(Map<String, List<String>> headers) Returns custom headers that have been added.booleanstatus()
-
Field Details
-
TEXT_CONTENT_TYPE
- See Also:
-
RESPONSE_PARAMS
-
-
Constructor Details
-
RestResponse
Creates a new response based onXContentBuilder. -
RestResponse
Creates a new plain text response. -
RestResponse
Creates a new plain text response. -
RestResponse
-
RestResponse
- Throws:
IOException
-
RestResponse
- Throws:
IOException
-
-
Method Details
-
chunked
public static RestResponse chunked(RestStatus restStatus, ChunkedRestResponseBodyPart content, @Nullable Releasable releasable) -
contentType
-
content
-
chunkedContent
-
isChunked
public boolean isChunked() -
status
-
copyHeaders
-
addHeader
Add a custom header. -
getHeaders
Returns custom headers that have been added. This method should not be used to mutate headers. -
filterHeaders
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceReleasable
-