Package org.springframework.web.client

Examples of org.springframework.web.client.RestTemplate.exchange()


                        HttpMethod.GET,
                        new HttpEntity<>(scimRequestHeaders),
                        String.class).getBody();
                break;
            case USERID:
                scimResponse = restTemplate.exchange(
                        identityServerUrl + "/Users/" + filterValue,
                        HttpMethod.GET,
                        new HttpEntity<>(scimRequestHeaders),
                        String.class).getBody();
                break;
View Full Code Here


      MultiValueMap<String, String> postParameters = new LinkedMultiValueMap<String, String>();

      HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(
          postParameters, requestHeaders);

      ResponseEntity<byte[]> response = httpClient.exchange(url,
          HttpMethod.GET, requestEntity, byte[].class);

      System.out.println(response);

      assertTrue("The server doesn't accept ranges", response
View Full Code Here

      MultiValueMap<String, String> postParameters = new LinkedMultiValueMap<String, String>();

      HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(
          postParameters, requestHeaders);

      ResponseEntity<byte[]> response = httpClient.exchange(url,
          HttpMethod.GET, requestEntity, byte[].class);

      System.out.println(response);

      assertEquals(
View Full Code Here

      MultiValueMap<String, String> postParameters = new LinkedMultiValueMap<String, String>();

      HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(
          postParameters, requestHeaders);

      ResponseEntity<byte[]> response = httpClient.exchange(url,
          HttpMethod.GET, requestEntity, byte[].class);

      System.out.println(response);

      assertEquals(
View Full Code Here

    requestHeaders.set("Content-Length", Integer.toString(info.length));

    HttpEntity<byte[]> requestEntity = new HttpEntity<byte[]>(info,
        requestHeaders);

    ResponseEntity<String> response = httpClient.exchange(url,
        HttpMethod.PUT, requestEntity, String.class);

    log.info("Put " + info.length + " bytes from " + firstByte + " to "
        + (firstByte + info.length));
View Full Code Here

    Person person = new Person();
    person.setId(1L);
    person.setName("Joe");

    ResponseEntity<String> response =
        restTemplate.exchange("http://localhost:8080/person/{id}",
            HttpMethod.DELETE,
            new HttpEntity<Person>(person),
            String.class,
            1);
View Full Code Here

  @Test
  public void test() {
    RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory());
    try {
      restTemplate.exchange("/someUrl", HttpMethod.PATCH, null, null);
      fail("Expected exception");
    }
    catch (IllegalArgumentException ex) {
      assertEquals("HTTP method PATCH not available before Apache HttpComponents HttpClient 4.2", ex.getMessage());
    }
View Full Code Here

    Assume.assumeTrue(serverOnline);

    try {

      RestTemplate template = new RestTemplate();
      ResponseEntity<String> result = template.exchange(url + "/home.json", HttpMethod.GET, null,
          String.class);
      String body = result.getBody();
      Assert.assertTrue("No home page found", body != null && body.length() > 0);

    }
View Full Code Here

      .isRunning("${SERVER_URL:http://localhost:8080/spring-batch-admin-sample}");

  @Test
  public void testHomePage() throws Exception {
    RestTemplate template = new RestTemplate();
    ResponseEntity<String> result = template.exchange(serverRunning.getUrl() + "/home.json", HttpMethod.GET, null,
        String.class);
    JsonWrapper wrapper = new JsonWrapper(result.getBody());
    assertNotNull(wrapper.get("feed.resources"));
    assertNotNull(wrapper.get("feed.resources['/files'].uri"));
  }
View Full Code Here

  }

  @Test
  public void testJobsPage() throws Exception {
    RestTemplate template = new RestTemplate();
    ResponseEntity<String> result = template.exchange(serverRunning.getUrl() + "/jobs.json", HttpMethod.GET, null,
        String.class);
    JsonWrapper wrapper = new JsonWrapper(result.getBody());
    // System.err.println(wrapper);
    assertNotNull(wrapper.get("jobs.resource"));
    assertNotNull(wrapper.get("jobs.registrations.infinite.name"));
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.