Esempio n. 1
0
 @Override
 protected URI rewriteURI(HttpServletRequest request) {
   try {
     final Server indexer = selector.pick();
     if (indexer == null) {
       throw new ISE("Cannot find instance of indexingService");
     }
     return new URI(
         request.getScheme(),
         indexer.getHost(),
         request.getRequestURI(),
         request.getQueryString(),
         null);
   } catch (URISyntaxException e) {
     throw Throwables.propagate(e);
   }
 }
  private String getRuleURL() throws URISyntaxException {
    Server server = selector.pick();

    if (server == null) {
      log.error("No instances found for [%s]!", config.get().getCoordinatorServiceName());
      return null;
    }

    return new URI(
            server.getScheme(),
            null,
            server.getAddress(),
            server.getPort(),
            config.get().getRulesEndpoint(),
            null,
            null)
        .toString();
  }