@Override public void onResponse(DeployResponse deployNodeResponses) { try { final XContentBuilder builder = restContentBuilder(request); builder.startObject() .field("deploy", true) .endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); } catch (Exception e) { onFailure(e); } }
@Override public void onResponse(CacheStatsPerFieldResponse response) { try { XContentBuilder builder = RestXContentBuilder.restContentBuilder(request); builder.startObject(); response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); } catch (Exception e) { onFailure(e); } }
public void onResponse(SearchIntoResponse response) { try { XContentBuilder builder = RestXContentBuilder .restContentBuilder( request); response.toXContent(builder, request); channel.sendResponse(new XContentRestResponse( request, OK, builder)); } catch (Exception e) { onFailure(e); } }
public void onResponse(ExportResponse response) { try { XContentBuilder builder = RestXContentBuilder.restContentBuilder(request); response.toXContent(builder, request); channel.sendResponse(new XContentRestResponse(request, OK, builder)); } catch (Exception e) { onFailure(e); } }
public void onResponse(ImportResponse response) { try { XContentBuilder builder = RestXContentBuilder.restContentBuilder(request); response.toXContent(builder, request); channel.sendResponse(new XContentRestResponse(request, OK, builder)); } catch (Exception e) { onFailure(e); } }
builder.field("error", "indexPrefix missing"); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, BAD_REQUEST, builder)); return; channel.sendResponse(new XContentRestResponse(request, OK, builder)); } catch (IOException ex) { try {
channel.sendResponse(new XContentRestResponse(request, BAD_REQUEST, builder.startObject().field("error", e.getMessage()).endObject())); } catch (IOException e1) { logger.error("Failed to send failure response", e1); channel.sendResponse(new XContentRestResponse(request, response.status(), builder)); } catch (Exception e) { if (logger.isDebugEnabled()) {
try { XContentBuilder builder = RestXContentBuilder.restContentBuilder(request); channel.sendResponse(new XContentRestResponse(request, BAD_REQUEST, builder.startObject().field("error", e.getMessage()).endObject())); } catch (IOException e1) { logger.error("Failed to send failure response", e1); XContentBuilder builder = RestXContentBuilder.restContentBuilder(request); response.toXContent(builder, request); channel.sendResponse(new XContentRestResponse(request, OK, builder)); } catch (Exception e) { onFailure(e);
channel.sendResponse(new XContentRestResponse(request, response.status(), builder)); } catch (Exception e) { if (logger.isDebugEnabled()) {
.endObject(); channel.sendResponse(new XContentRestResponse(request, RestStatus.BAD_REQUEST, builder)); return; getResponse.toXContent(builder, request); if (!getResponse.isExists()) { channel.sendResponse(new XContentRestResponse(request, NOT_FOUND, builder)); } else { status = CREATED; channel.sendResponse(new XContentRestResponse( request, status, builder)); .field("reason", "source is empty") .endObject(); channel.sendResponse(new XContentRestResponse( request, RestStatus.BAD_REQUEST, builder));
getResponse.toXContent(builder, request); if (!getResponse.isExists()) { channel.sendResponse(new XContentRestResponse(request, NOT_FOUND, builder)); } else { .field("reason", "source is empty") .endObject(); channel.sendResponse(new XContentRestResponse( request, RestStatus.BAD_REQUEST, builder));
try { XContentBuilder builder = RestXContentBuilder.restContentBuilder(request); channel.sendResponse(new XContentRestResponse(request, BAD_REQUEST, builder.startObject().field("error", e.getMessage()).endObject())); } catch (IOException e1) { logger.error("Failed to send failure response", e1); XContentBuilder builder = RestXContentBuilder.restContentBuilder(request); response.toXContent(builder, request); channel.sendResponse(new XContentRestResponse(request, OK, builder)); } catch (Exception e) { onFailure(e);
.restContentBuilder( request); channel.sendResponse(new XContentRestResponse(request, BAD_REQUEST, builder.startObject().field("error", e.getMessage()).endObject())); request); response.toXContent(builder, request); channel.sendResponse(new XContentRestResponse( request, OK, builder)); } catch (Exception e) {