Package com.sun.jersey.api.client

Examples of com.sun.jersey.api.client.ClientResponse


    @Test
    public void testFeedEntityWithValidTable() throws Exception {
        Map<String, String> overlay = context.getUniqueOverlay();
        overlay.put("colo", "default");

        ClientResponse response = context.submitToFalcon(TestContext.CLUSTER_TEMPLATE, overlay, EntityType.CLUSTER);
        context.assertSuccessful(response);

        // submission will parse and validate the feed with table
        overlay.put("tableUri", TABLE_URI);
        response = context.submitToFalcon("/hive-table-feed.xml", overlay, EntityType.FEED);
View Full Code Here


        throws Exception {

        Map<String, String> overlay = context.getUniqueOverlay();
        overlay.put("colo", "default");

        ClientResponse response = context.submitToFalcon(TestContext.CLUSTER_TEMPLATE, overlay, EntityType.CLUSTER);
        context.assertSuccessful(response);

        // submission will parse and validate the feed with table
        overlay.put("tableUri", tableUri);
        response = context.submitToFalcon("/hive-table-feed.xml", overlay, EntityType.FEED);
View Full Code Here

     */
    @Test
    public void testClusterEntityWithValidInterfaces() throws Exception {
        overlay = context.getUniqueOverlay();
        overlay.put("colo", "default");
        ClientResponse response = context.submitToFalcon(TestContext.CLUSTER_TEMPLATE, overlay, EntityType.CLUSTER);
        context.assertSuccessful(response);
    }
View Full Code Here

        Interface anInterface = ClusterHelper.getInterface(cluster, interfacetype);
        anInterface.setEndpoint(endpoint);

        File tmpFile = context.getTempFile();
        EntityType.CLUSTER.getMarshaller().marshal(cluster, tmpFile);
        ClientResponse response = context.submitFileToFalcon(EntityType.CLUSTER, tmpFile.getAbsolutePath());
        context.assertFailure(response);
    }
View Full Code Here

      LOGGER.error("Reached maximum number of attempts to resubmit job, aborting");
      return false;
    }
    String url = zencoderAPIBaseUrl + "jobs/" + id + "/resubmit?api_key="
        + zencoderAPIKey;
    ClientResponse response = sendPutRequest(url);
    if(response == null) {
      currentConnectionAttempt++;
      return resubmitJob(id);
    }
    int responseStatus = response.getStatus();
    resetConnectionCount();
    if (responseStatus == 200 || responseStatus == 204) {
      return true;
    } else if (responseStatus == 409) {
      LOGGER.debug("Already finished job {}", id);
View Full Code Here

      LOGGER.error("Reached maximum number of attempts to cancel job, aborting");
      return false;
    }
    String url = zencoderAPIBaseUrl + "jobs/" + id
        + "/cancel.json?api_key=" + zencoderAPIKey;
    ClientResponse res = sendPutRequest(url);
    if(res == null) {
      currentConnectionAttempt++;
      return cancelJob(id);
    }
    int responseStatus = res.getStatus();
    resetConnectionCount();
    if (responseStatus == 200 || responseStatus == 204) {
      return true;
    } else if (responseStatus == 409) {
      LOGGER.debug("Already finished job {}", id);
View Full Code Here

  protected ClientResponse sendPutRequest(String url) {
    LOGGER.debug("calling: {}", url);
    try {
      WebResource webResource = httpClient.resource(url);
      ClientResponse response = webResource.put(ClientResponse.class);

      LOGGER.debug("Got response: {}", response);
      return response;
    } catch (Exception e) {
      if(e instanceof SocketTimeoutException) {
View Full Code Here

          .header("Content-Type", "application/xml")
          .post(Document.class, xml);
      logXmlDocumentToDebug("Got response", response);
      return response;
    } catch (UniformInterfaceException e) {
      ClientResponse resp = e.getResponse();
      Document errorXml = resp.getEntity(Document.class);
      String errormessage = e.getMessage();
      try {
        errormessage = (String) xPath.evaluate(
            "/api-response/errors/error", errorXml,
            XPathConstants.STRING);
View Full Code Here

    public ClientResponse handle(ClientRequest request) throws ClientHandlerException {
        long id = ++this._id;

        logRequest(id, request);

        ClientResponse response = getNext().handle(request);

        logResponse(id, response);

        return response;
    }
View Full Code Here

      headers.add("Content-Type", request.entity().getContentType());
    } else {
      headers.add("Content-Type", "application/json");
    }
    try {
      ClientResponse response = null;
      if (request.entity() != null && request.entity().getEntity() != null) {
        response = target.getHeadHandler().handle(new ClientRequestImpl(target.getURI(), request.method().name(), request.entity().getEntity(), headers));
      } else {
        response = target.getHeadHandler().handle(new ClientRequestImpl(target.getURI(), request.method().name(), null, headers));
      }
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.client.ClientResponse

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.