public abstract class AbstractRestChannel extends java.lang.Object implements RestChannel
Modifier and Type | Field and Description |
---|---|
protected boolean |
detailedErrorsEnabled |
protected RestRequest |
request |
Modifier | Constructor and Description |
---|---|
protected |
AbstractRestChannel(RestRequest request,
boolean detailedErrorsEnabled) |
Modifier and Type | Method and Description |
---|---|
BytesStreamOutput |
bytesOutput()
A channel level bytes output that can be reused.
|
protected BytesStreamOutput |
bytesOutputOrNull()
An accessor to the raw value of the channel bytes output.
|
boolean |
detailedErrorsEnabled() |
XContentBuilder |
newBuilder() |
XContentBuilder |
newBuilder(XContentType requestContentType,
boolean useFiltering)
Creates a new
XContentBuilder for a response to be sent using this channel. |
protected BytesStreamOutput |
newBytesOutput() |
XContentBuilder |
newErrorBuilder() |
RestRequest |
request() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
sendResponse
protected final RestRequest request
protected final boolean detailedErrorsEnabled
protected AbstractRestChannel(RestRequest request, boolean detailedErrorsEnabled)
public XContentBuilder newBuilder() throws java.io.IOException
newBuilder
in interface RestChannel
java.io.IOException
public XContentBuilder newErrorBuilder() throws java.io.IOException
newErrorBuilder
in interface RestChannel
java.io.IOException
public XContentBuilder newBuilder(@Nullable XContentType requestContentType, boolean useFiltering) throws java.io.IOException
XContentBuilder
for a response to be sent using this channel. The builder's type is determined by the following
logic. If the request has a format parameter that will be used to attempt to map to an XContentType
. If there is no format
parameter, the HTTP Accept header is checked to see if it can be matched to a XContentType
. If this first attempt to map
fails, the request content type will be used if the value is not null
; if the value is null
the output format falls
back to JSON.newBuilder
in interface RestChannel
java.io.IOException
public final BytesStreamOutput bytesOutput()
newBytesOutput()
. Once the stream is created, it gets reset on each
call to this method.bytesOutput
in interface RestChannel
protected final BytesStreamOutput bytesOutputOrNull()
protected BytesStreamOutput newBytesOutput()
public RestRequest request()
request
in interface RestChannel
public boolean detailedErrorsEnabled()
detailedErrorsEnabled
in interface RestChannel