Examples of XContentThrowableRestResponse


Examples of org.elasticsearch.rest.XContentThrowableRestResponse

        if (text == null && request.hasContent()) {
            text = request.contentAsString();
        }
        if (text == null) {
            try {
                channel.sendResponse(new XContentThrowableRestResponse(request, new ElasticSearchIllegalArgumentException("text is missing")));
            } catch (IOException e1) {
                logger.warn("Failed to send response", e1);
            }
            return;
        }

        AnalyzeRequest analyzeRequest = new AnalyzeRequest(request.param("index"), text);
        analyzeRequest.preferLocal(request.paramAsBoolean("prefer_local", analyzeRequest.preferLocalShard()));
        analyzeRequest.analyzer(request.param("analyzer"));
        analyzeRequest.field(request.param("field"));
        client.admin().indices().analyze(analyzeRequest, new ActionListener<AnalyzeResponse>() {
            @Override public void onResponse(AnalyzeResponse response) {
                try {
                    XContentBuilder builder = restContentBuilder(request);
                    builder.startObject();
                    response.toXContent(builder, request);
                    builder.endObject();
                    channel.sendResponse(new XContentRestResponse(request, OK, builder));
                } catch (Exception e) {
                    onFailure(e);
                }
            }

            @Override public void onFailure(Throwable e) {
                try {
                    channel.sendResponse(new XContentThrowableRestResponse(request, e));
                } catch (IOException e1) {
                    logger.error("Failed to send failure response", e1);
                }
            }
        });
View Full Code Here

Examples of org.elasticsearch.rest.XContentThrowableRestResponse

                }
            }

            @Override public void onFailure(Throwable e) {
                try {
                    channel.sendResponse(new XContentThrowableRestResponse(request, e));
                } catch (IOException e1) {
                    logger.error("Failed to send failure response", e1);
                }
            }
        });
View Full Code Here

Examples of org.elasticsearch.rest.XContentThrowableRestResponse

                }
            }

            @Override public void onFailure(Throwable e) {
                try {
                    channel.sendResponse(new XContentThrowableRestResponse(request, e));
                } catch (IOException e1) {
                    logger.error("Failed to send failure response", e1);
                }
            }
        });
View Full Code Here

Examples of org.elasticsearch.rest.XContentThrowableRestResponse

                }
            }

            @Override public void onFailure(Throwable e) {
                try {
                    channel.sendResponse(new XContentThrowableRestResponse(request, e));
                } catch (IOException e1) {
                    logger.error("Failed to send failure response", e1);
                }
            }
        });
View Full Code Here

Examples of org.elasticsearch.rest.XContentThrowableRestResponse

                }
            }

            @Override public void onFailure(Throwable e) {
                try {
                    channel.sendResponse(new XContentThrowableRestResponse(request, e));
                } catch (IOException e1) {
                    logger.error("Failed to send failure response", e1);
                }
            }
        });
View Full Code Here

Examples of org.elasticsearch.rest.XContentThrowableRestResponse

                }
            }

            @Override public void onFailure(Throwable e) {
                try {
                    channel.sendResponse(new XContentThrowableRestResponse(request, e));
                } catch (IOException e1) {
                    logger.error("Failed to send failure response", e1);
                }
            }
        });
View Full Code Here

Examples of org.elasticsearch.rest.XContentThrowableRestResponse

                }
            }

            @Override public void onFailure(Throwable e) {
                try {
                    channel.sendResponse(new XContentThrowableRestResponse(request, e));
                } catch (IOException e1) {
                    logger.error("Failed to send failure response", e1);
                }
            }
        });
View Full Code Here

Examples of org.elasticsearch.rest.XContentThrowableRestResponse

          }

          @Override
          public void onFailure(Throwable e) {
            try {
              restChannel.sendResponse(new XContentThrowableRestResponse(restRequest, e));
            } catch (IOException e1) {
              logger.error("Failed to send failure response", e1);
            }
          }
View Full Code Here

Examples of org.elasticsearch.rest.XContentThrowableRestResponse

  protected abstract void handleJiraRiverResponse(NodeResponse nodeInfo) throws Exception;

  @Override
  public void onFailure(Throwable e) {
    try {
      restChannel.sendResponse(new XContentThrowableRestResponse(restRequest, e));
    } catch (IOException e1) {
      logger.error("Failed to send failure response", e1);
    }
  }
View Full Code Here

Examples of org.elasticsearch.rest.XContentThrowableRestResponse

            if (!internalCall)
                channel.sendResponse(new XContentRestResponse(request, OK, builder));
        } catch (IOException ex) {
            if (!internalCall) {
                try {
                    channel.sendResponse(new XContentThrowableRestResponse(request, ex));
                } catch (Exception ex2) {
                    logger.error("problem while rolling index", ex2);
                }
            } else {
                throw new RuntimeException(ex);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.