Package com.netflix.niws.client.http

Examples of com.netflix.niws.client.http.HttpClientResponse


              + key)
          )
          .setQueryParams(queryParams)
          .build();
     
      HttpClientResponse response = client
          .executeWithLoadBalancer(request);
     
      if (response.getStatus() != 200) { 
        logger.error("error status: {}", response.getStatus());
        throw new Exception("error status: " + response.getStatus());
      }

      return IOUtils.toString(response.getRawEntity(), Charsets.UTF_8);
    } catch (Exception exc) {
      throw new RuntimeException("Exception", exc);
    }
  }
View Full Code Here


              + "/"
              + key))
          //.setHeaders(headers)
          .build();
     
      HttpClientResponse response = client
          .executeWithLoadBalancer(request);

      if (response.getStatus() != 200) { 
        logger.error("error status: {}", response.getStatus());
        throw new Exception("error status: " + response.getStatus());
      }
     
      return IOUtils.toString(response.getRawEntity(), Charsets.UTF_8);
    } catch (Exception exc) {
      logger.error("Exception calling middletier while retrieving logs.", exc);
      throw new RuntimeException("Exception", exc);
    }
  }
View Full Code Here

     * Fetch the RSS feed content using Ribbon
     */
    private RSS fetchRSSFeed(String url) {

        RestClient client = (RestClient) ClientFactory.getNamedClient(RSSConstants.MIDDLETIER_REST_CLIENT);
        HttpClientResponse response;
        String rssData = null;

        try {
            HttpClientRequest request = HttpClientRequest.newBuilder().setUri(new URI(url)).build();
            response = client.execute(request);

            if (response != null) {
                rssData  = IOUtils.toString(response.getRawEntity(), Charsets.UTF_8);
                logger.info("Status code for " + response.getRequestedURI() + " : " + response.getStatus());
            }
        } catch (URISyntaxException e) {
            logger.error("Exception occurred when setting the URI", e);
        } catch (Exception e) {
            logger.error("Exception occurred when executing the HTTP request", e);
View Full Code Here

          .setUri(new URI("/"
              + RSSConstants.MIDDLETIER_WEB_RESOURCE_ROOT_PATH
              + RSSConstants.RSS_ENTRY_POINT)
                    )
          .build();
      HttpClientResponse response = client.executeWithLoadBalancer(request);

      return IOUtils.toString(response.getRawEntity(), Charsets.UTF_8);
    } catch (Exception exc) {
      throw new RuntimeException("Exception", exc);
    }
  }
View Full Code Here

          .setUri(new URI("/"
              + RSSConstants.MIDDLETIER_WEB_RESOURCE_ROOT_PATH
              + RSSConstants.RSS_ENTRY_POINT
                            + "?url=" + url))
          .build();
      HttpClientResponse response = client.executeWithLoadBalancer(request);

      return IOUtils.toString(response.getRawEntity(), Charsets.UTF_8);
    } catch (Exception exc) {
      throw new RuntimeException("Exception occurred when adding a RSS feed", exc);
    }
  }
View Full Code Here

                            + RSSConstants.MIDDLETIER_WEB_RESOURCE_ROOT_PATH
                            + RSSConstants.RSS_ENTRY_POINT
                            + "?url=" + url)
                    )
          .build();
      HttpClientResponse response = client.executeWithLoadBalancer(request);

      return IOUtils.toString(response.getRawEntity(), Charsets.UTF_8);
    } catch (Exception exc) {
      throw new RuntimeException("Exception", exc);
    }
  }
View Full Code Here

TOP

Related Classes of com.netflix.niws.client.http.HttpClientResponse

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.