Package com.sun.jersey.api.client

Examples of com.sun.jersey.api.client.WebResource.type()


    formData.add("duration", "341");
//    formData.add("meta", "recordings releasegroups compress");
//    formData.add("meta", "recordings recordingids releases releaseids releasegroups releasegroupids tracks puids usermeta sources");
    formData.add("meta", "recordings releases releasegroups sources tracks usermeta compress");
    formData.add("fingerprint", "AQADtEokMsoUIv-hTxpCXbAOZ8fxBHh8ZJWyQG10IV8Jo2RyXMQf_B0udD08hFU0I7lyPCN6nDl-3IapIMc3pRCr7PCR4wnD48Plwyb64kdeVN2FT4d4HeHxiOiuVHB-_HCmwDvCF7pShFvho-SFC5fTodcMq_hx5sgsQbMf5GhJNMpH_Hj2Do-OUkeWMIfO0Mhz3ELzo4pzcK2OX8eVBz8lhNGoB-rR5kP4jCMaB9_64GkmEeeLKw2ao9YS5ExMIVl4SjgzEj5ROyiVwy_GLVkwRV0u_KmQh9CPXDnaHc6NJ1IIO9Th_uito0eWTLnwRDzUK0UY_UKv40sa4kq4o2GO6uiRp9B7ZIeffPiNypnwhKGKyaKw54fXw0h25MxJ_EKd6QmuJAXzoEQT5diVOcKppcJ1-A9-PJGGS8eT3XA2Bld2XCrCG5qeB00XPUIfDU-LhhG6LFmgZxTuZ2ge4vYhbolwUUrQJPPwrEV-5JeCB_0FLVMT_Eb04BOYS8K1RYe3GFVWNHGIWsh3JHuO4ymuB1b-oFZjfApqsYedVAipQ43GBqHEKNngXph-XJry4NGD-nBzCY-O5Bk75M7gSkfVXHikGObz4Y1E7AcT-UNJKceXyWiioz9KqqBqtMqS0LiKvHVENPHxR4O5bESt5KhzpDz6yMaR3ZBvRKSOJ8erBr_g487x9OjTR0iHKo2O-MtwSlliNOiPqwAacll09JmgSza8Rcc_SjgbCc6TC8nGIQyOLqTQ8D6eRhR-JOGRg4l19McTg09kODeeaAquG7mGhHnwl8E_4x-wJzzRK8J5oXnwDLEe_CnEPGFx4UQepUczGcluDrmI5tXgiDmcJOUxncih5UFILlsENkuOClOSJchFH8_SwE-xL8i-Dk8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AQ4RAoCwhABjhDBCCQWUAMQAJAwiRhsEhqMAEAAIAQgAhIxTgAIAAFXGGSsgQwQwYQQABAmilCJGAKARAUApBFkChguEIADAMSCgUIYopgRxAAhgEAOCGAAQAkQoAIQQABDBiAJCIEIIEEIqACQRgiAGiCKEIAOgAIQECIgAQBhDmQLGKWEgIQAxAJxQAhBmlAMCAUIoQEQAKACQAhkEhTGGCCUgMIQAQYACRBjhnJCMECIEAg4JpaCiAgDgAQEACYKEUcoIgBiBBighAQCECEoAAsAqRYwDRhhDCAHIKMKUA1IAKoKChCAkgEEICCMEEc4IYgAARiDjBACACAEEBoAgZBQARAggIBFCAMJIZEJQIYRgyABGDHAUAAs0IMYQQ4QRAEMABERCOCAOgwwJgwAxwgjEBFDEKSKQoggJYIAUmAhjGACEEGGYEIQBgpCEQhjEgBDQACUQYAw4YgwFiCiBjAEIECAwQAAIBZAgQBoFgIEGC4SRIEABYAlzgBiCEKGAGUKFQBQB5Ag0gBgCGGIICGAclcoKQJyiABAIlAJAACKYsBA");
    JSONObject response = webResource.type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(JSONObject.class, formData);
    System.out.println("answer: "+response.toString());
        ObjectMapper mapper = new ObjectMapper();
        List<AcoustIdWsResult> results = null;
        try {
      results  = mapper.readValue(response.getString("results"), new TypeReference<List<AcoustIdWsResult>>(){});
View Full Code Here


    RegistrationResponse response;
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    client = Client.create(clientConfig);
    WebResource webResource = client.resource("http://localhost:9998/register/dummyhost");
    response = webResource.type(MediaType.APPLICATION_JSON)
        .post(RegistrationResponse.class, createDummyJSONRegister());
    LOG.info("Returned from Server responce=" + response);
    Assert.assertEquals(response.getResponseStatus(), RegistrationStatus.OK);
  }
View Full Code Here

    HeartBeatResponse response;
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    client = Client.create(clientConfig);
    WebResource webResource = client.resource("http://localhost:9998/heartbeat/dummyhost");
    response = webResource.type(MediaType.APPLICATION_JSON)
        .post(HeartBeatResponse.class, createDummyHeartBeat());
    LOG.info("Returned from Server: "
        + " response=" + response);
    Assert.assertEquals(response.getResponseId(), 0L);
  }
View Full Code Here

    HeartBeatResponse response;
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    client = Client.create(clientConfig);
    WebResource webResource = client.resource("http://localhost:9998/heartbeat/dummyhost");
    response = webResource.type(MediaType.APPLICATION_JSON)
        .post(HeartBeatResponse.class, createDummyHeartBeatWithAgentEnv());
    LOG.info("Returned from Server: "
        + " response=" + response);
    Assert.assertEquals(response.getResponseId(), 0L);
  }
View Full Code Here

  @Test
  public void testRegistration() throws JSONException, Exception {
    RegistrationResponse response;
    Client client = createTestClient();
    WebResource webResource = client.resource(AGENT_URL + "test/register");
    response = webResource.type(MediaType.APPLICATION_JSON)
        .post(RegistrationResponse.class, createDummyJSONRegister());
    Assert.assertEquals(RegistrationStatus.OK, response.getResponseStatus());
  }

  protected Client createTestClient() {
View Full Code Here

  @Test
  public void testHeartbeat() throws JSONException, Exception {
    HeartBeatResponse response;
    Client client = createTestClient();
    WebResource webResource = client.resource(AGENT_URL + "test/heartbeat");
    response = webResource.type(MediaType.APPLICATION_JSON)
        .post(HeartBeatResponse.class, createDummyHeartBeat());
    assertEquals(response.getResponseId(), 0L);
  }

  @Test
View Full Code Here

  @Test
  public void testHeadURL() throws JSONException, Exception {
    Client client = createTestClient();
    WebResource webResource = client.resource(AGENT_URL);
    ClientResponse response = webResource.type(MediaType.APPLICATION_JSON)
                                         .head();
    assertEquals(200, response.getStatus());
  }

  @Test
View Full Code Here

        }
        WebResource aResource = apiClient.resource(resourceURL);


        //set the required HTTP headers
        Builder builder = aResource.type("application/json");
        for(String key : headerMap.keySet()){
            builder.header(key, headerMap.get(key));
        }
        if(headerParams != null){
            for(String key : headerParams.keySet()){
View Full Code Here

    {
      final String path = URLEncoder.encodeUTF8(URLDecoder.decode(normalizePath(file.getPath().replaceAll("\\+", "%2B")), "UTF-8")).replaceAll("\\!", "%21");
      final String service = MessageFormat.format(CREATE_FOLDER_SERVICE, path);

      final WebResource resource = client.resource(url + service);
      final ClientResponse response = resource.type("text/plain").put(ClientResponse.class, null);
      if (response.getStatus() == 200)
      {
        refresh();
      }
      else
View Full Code Here

      part.field("overwriteFile", String.valueOf(overwriteIfExists), MediaType.MULTIPART_FORM_DATA_TYPE);
      part.field( "fileNameOverride", fileName, MediaType.MULTIPART_FORM_DATA_TYPE );
     
      part.getField("fileUpload").setContentDisposition(FormDataContentDisposition.name("fileUpload").fileName( fileName ).build());

      WebResource.Builder builder = resource.type(MediaType.MULTIPART_FORM_DATA);
      ClientResponse response =  builder.post(ClientResponse.class, part);

      if(response != null){
        String message = response.getEntity(String.class);
        logger.info(message);
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.