Package org.elasticsearch.rest

Examples of org.elasticsearch.rest.BytesRestResponse


  @Override
  public void onResponse(Response response) {
    try {
      NodeResponse nodeInfo = response.getSuccessNodeResponse();
      if (nodeInfo == null) {
        restChannel.sendResponse(new BytesRestResponse(RestStatus.NOT_FOUND, buildMessageDocument(restRequest,
            "No JiraRiver found for name: " + actionRequest.getRiverName())));
      } else {
        handleJiraRiverResponse(nodeInfo);
      }
    } catch (Exception e) {
View Full Code Here


  protected abstract void handleJiraRiverResponse(NodeResponse nodeInfo) throws Exception;

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

            channel.sendResponse(new StringRestResponse(FORBIDDEN));
            return;
        }
        try {
            byte[] data = Streams.copyToByteArray(file);
            channel.sendResponse(new BytesRestResponse(data, guessMimeType(sitePath)));
        } catch (IOException e) {
            channel.sendResponse(new StringRestResponse(INTERNAL_SERVER_ERROR));
        }
    }
View Full Code Here

                restRequest, restChannel) {

              @Override
              protected void handleRiverResponse(NodeJRPeriodResponse nodeInfo) throws Exception {
                if (nodeInfo.indexerFound) {
                  restChannel.sendResponse(new BytesRestResponse(OK, buildMessageDocument(restRequest,
                      "Period changed to " + period + "[ms] for at least one of defined indexers")));
                } else {
                  restChannel.sendResponse(new BytesRestResponse(RestStatus.NOT_FOUND, buildMessageDocument(
                      restRequest, "No any of defined indexers '" + indexerNames + "' found")));
                }
              }

            });
View Full Code Here

            new JRMgmBaseActionListener<JRLifecycleRequest, JRLifecycleResponse, NodeJRLifecycleResponse>(
                actionRequest, restRequest, restChannel) {

              @Override
              protected void handleRiverResponse(NodeJRLifecycleResponse nodeInfo) throws Exception {
                restChannel.sendResponse(new BytesRestResponse(OK, buildMessageDocument(restRequest,
                    "Command successful")));
              }

            });
  }
View Full Code Here

              XContentBuilder builder = RestXContentBuilder.restContentBuilder(restRequest);
              builder.startObject();
              builder.field("sysinfo_river_names", allRivers);
              builder.endObject();
              restChannel.sendResponse(new BytesRestResponse(RestStatus.OK, builder));
            } catch (Exception e) {
              onFailure(e);
            }
          }

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

  @Override
  public void onResponse(Response response) {
    try {
      NodeResponse nodeInfo = response.getSuccessNodeResponse();
      if (nodeInfo == null) {
        restChannel.sendResponse(new BytesRestResponse(RestStatus.NOT_FOUND, buildMessageDocument(restRequest,
            "No SysinfoRiver found for name: " + actionRequest.getRiverName())));
      } else {
        handleRiverResponse(nodeInfo);
      }
    } catch (Exception e) {
View Full Code Here

  protected abstract void handleRiverResponse(NodeResponse nodeInfo) throws Exception;

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

            new JRMgmBaseActionListener<JRLifecycleRequest, JRLifecycleResponse, NodeJRLifecycleResponse>(
                actionRequest, restRequest, restChannel) {

              @Override
              protected void handleJiraRiverResponse(NodeJRLifecycleResponse nodeInfo) throws Exception {
                restChannel.sendResponse(new BytesRestResponse(OK, buildMessageDocument(restRequest,
                    "Command successful")));
              }

            });
  }
View Full Code Here

              XContentBuilder builder = restChannel.newBuilder();
              builder.startObject();
              builder.field("jira_river_names", allRivers);
              builder.endObject();
              restChannel.sendResponse(new BytesRestResponse(RestStatus.OK, builder));
            } catch (Exception e) {
              onFailure(e);
            }
          }

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

TOP

Related Classes of org.elasticsearch.rest.BytesRestResponse

Copyright © 2018 www.massapicom. 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.