Examples of ClientResponse


Examples of at.newmedialab.ldclient.model.ClientResponse

                        triples = parseRDFResponse(resource,in,contentType);
                    }



                    ClientResponse result = new ClientResponse(triples);

                    Header expires = response.getFirstHeader("Expires");
                    if(expires != null) {
                        try {
                            Date expiresDate = DateUtils.parseDate(expires.getValue());
                            result.setExpires(expiresDate);
                        } catch (DateParseException e) {
                            log.warn("could not parse Expires: header, using default expiry settings");
                            Date expiresDate = new Date(System.currentTimeMillis()+defaultExpires*1000);
                            result.setExpires(expiresDate);
                        }
                    } else {
                        Date expiresDate = new Date(System.currentTimeMillis()+defaultExpires*1000);
                        result.setExpires(expiresDate);
                    }

                    if(log.isInfoEnabled()) {
                        RepositoryConnection con = triples.getConnection();
                        log.info("retrieved {} triples for resource {}; expiry date: {}",new Object[] {con.size(),resource.stringValue(),result.getExpires()});
                        con.close();
                    }

                    return result;
                } finally {
View Full Code Here

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


                //Sending bundle to endpoint
                WebResource resource = client.resource(endpoint.toURL()+"/api/bundlePublisher/publish");

                ClientResponse response =
                    resource.type(MediaType.MULTIPART_FORM_DATA).post(ClientResponse.class, form);


                if(response.getClientResponseStatus().getStatusCode() == HttpStatus.SC_OK)
                {
                  detail.setStatus(PublishAuditStatus.Status.BUNDLE_SENT_SUCCESSFULLY.getCode());
                  detail.setInfo("Everything ok");
                } else {

                  if(currentStatusHistory.getNumTries()==PublisherQueueJob.MAX_NUM_TRIES) {
                    APILocator.getPushedAssetsAPI().deletePushedAssets(config.getId(), environment.getId());
                  }
                  detail.setStatus(PublishAuditStatus.Status.FAILED_TO_SENT.getCode());
                  detail.setInfo(
                      "Returned "+response.getClientResponseStatus().getStatusCode()+ " status code " +
                          "for the endpoint "+endpoint.getId()+ "with address "+endpoint.getAddress());
                  failedEnvironment |= true;

                }
              } catch(Exception e) {
View Full Code Here

Examples of com.hazelcast.client.ClientResponse

    public Object sendAndReceive(ClientRequest request, ClientConnection connection) throws Exception {
        final SerializationService ss = client.getSerializationService();
        connection.write(ss.toData(request));
        final Data data = connection.read();
        ClientResponse clientResponse = ss.toObject(data);
        Object response = ss.toObject(clientResponse.getResponse());
        if (response instanceof Throwable) {
            Throwable t = (Throwable) response;
            ExceptionUtil.fixRemoteStackTrace(t, Thread.currentThread().getStackTrace());
            throw new Exception(t);
        }
View Full Code Here

Examples of com.hazelcast.client.impl.client.ClientResponse

        try {
            packet = (Packet) connection.q.take();
        } catch (InterruptedException e) {
            throw new HazelcastException(e);
        }
        ClientResponse clientResponse = serializationService.toObject(packet.getData());
        return serializationService.toObject(clientResponse.getResponse());
    }
View Full Code Here

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

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

        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

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

     */
    @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

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

        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

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

      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

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

      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
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.