Package org.elasticsearch.rest
Class BytesRestResponse
- java.lang.Object
-
- org.elasticsearch.rest.RestResponse
-
- org.elasticsearch.rest.BytesRestResponse
-
public class BytesRestResponse extends RestResponse
-
-
Field Summary
Fields Modifier and Type Field Description static StringTEXT_CONTENT_TYPE
-
Constructor Summary
Constructors Constructor Description BytesRestResponse(RestChannel channel, Exception e)BytesRestResponse(RestChannel channel, RestStatus status, Exception e)BytesRestResponse(RestStatus status, String content)Creates a new plain text response.BytesRestResponse(RestStatus status, String contentType, byte[] content)Creates a binary response.BytesRestResponse(RestStatus status, String contentType, String content)Creates a new plain text response.BytesRestResponse(RestStatus status, String contentType, BytesReference content)Creates a binary response.BytesRestResponse(RestStatus status, XContentBuilder builder)Creates a new response based onXContentBuilder.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BytesReferencecontent()The response content.StringcontentType()The response content type.static ElasticsearchStatusExceptionerrorFromXContent(XContentParser parser)RestStatusstatus()The rest status code.-
Methods inherited from class org.elasticsearch.rest.RestResponse
addHeader, copyHeaders, getHeaders
-
-
-
-
Field Detail
-
TEXT_CONTENT_TYPE
public static final String TEXT_CONTENT_TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BytesRestResponse
public BytesRestResponse(RestStatus status, XContentBuilder builder)
Creates a new response based onXContentBuilder.
-
BytesRestResponse
public BytesRestResponse(RestStatus status, String content)
Creates a new plain text response.
-
BytesRestResponse
public BytesRestResponse(RestStatus status, String contentType, String content)
Creates a new plain text response.
-
BytesRestResponse
public BytesRestResponse(RestStatus status, String contentType, byte[] content)
Creates a binary response.
-
BytesRestResponse
public BytesRestResponse(RestStatus status, String contentType, BytesReference content)
Creates a binary response.
-
BytesRestResponse
public BytesRestResponse(RestChannel channel, Exception e) throws IOException
- Throws:
IOException
-
BytesRestResponse
public BytesRestResponse(RestChannel channel, RestStatus status, Exception e) throws IOException
- Throws:
IOException
-
-
Method Detail
-
contentType
public String contentType()
Description copied from class:RestResponseThe response content type.- Specified by:
contentTypein classRestResponse
-
content
public BytesReference content()
Description copied from class:RestResponseThe response content. Note, if the content isReleasableit should automatically be released when done by the channel sending it.- Specified by:
contentin classRestResponse
-
status
public RestStatus status()
Description copied from class:RestResponseThe rest status code.- Specified by:
statusin classRestResponse
-
errorFromXContent
public static ElasticsearchStatusException errorFromXContent(XContentParser parser) throws IOException
- Throws:
IOException
-
-