Example usage for org.springframework.web.client RestTemplate RestTemplate

List of usage examples for org.springframework.web.client RestTemplate RestTemplate

Introduction

In this page you can find the example usage for org.springframework.web.client RestTemplate RestTemplate.

Prototype

public RestTemplate() 

Source Link

Document

Create a new instance of the RestTemplate using default settings.

Usage

From source file:nl.flotsam.greader.rest.RestInvoker.java

private RestInvoker(HttpMethod method, String uri) {
    this(method, uri, new RestTemplate());
}

From source file:com.neiljbrown.brighttalk.channels.reportingapi.client.spring.SpringApiClientImplTest.java

/**
 * Tests constructor {@link SpringApiClientImpl#SpringApiClientImpl(String, String, Integer, RestTemplate)} in the
 * case where the supplied protocol and port are for valid, encrypted communications.
 *///from   w w  w.  j a va2s.c o m
@Test
public final void testConstructValidEncryptedProtocolAndPort() {
    new SpringApiClientImpl("https", "api.test.brighttalk.net", 443, new RestTemplate());
}

From source file:se.sawano.scala.examples.scalaspringmvc.ControllerTestIT.java

@Before
public void setUp() {
    restTemplate = new RestTemplate();
    baseUrl = "http://localhost:9090/scala-spring-mvc/";
}

From source file:com.unknown.pkg.InfoEndpointApplicationIT.java

@Test
public void fetchInfo() {
    RestTemplate rest = new RestTemplate();
    ResponseEntity<String> response = rest.getForEntity("http://localhost:" + port + "/info", String.class);
    Assertions.assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
    Assertions.assertThat(response.getBody()).contains("\"version\":\"0.9.0-SNAPSHOT\"");
}

From source file:io.syndesis.inspector.DataMapperClassInspectorTest.java

@Test
public void shouldHandleNesting() throws Exception {
    DataMapperClassInspector dataMapperClassInspector = new DataMapperClassInspector(infinispan.getCaches(),
            new RestTemplate(), config);

    mockServer.expect().get().withPath("/v2/atlas/java/class?className=twitter4j.StatusJSONImpl")
            .andReturn(200, Resources.toString(getClass().getResource("/twitter4j.StatusJSONImpl.json"),
                    Charset.defaultCharset()))
            .always();//ww  w  . j  a v  a 2s.  co  m
    mockServer
            .expect().get().withPath("/v2/atlas/java/class?className=twitter4j.Logger").andReturn(200, Resources
                    .toString(getClass().getResource("/twitter4j.Logger.json"), Charset.defaultCharset()))
            .always();
    mockServer.expect().get().withPath("/v2/atlas/java/class?className=twitter4j.LoggerFactory")
            .andReturn(200, Resources.toString(getClass().getResource("/twitter4j.LoggerFactory.json"),
                    Charset.defaultCharset()))
            .always();
    List<String> paths = dataMapperClassInspector.getPaths("java", "twitter4j.StatusJSONImpl", null, null);

    Assert.assertNotNull(paths);
    Assert.assertTrue(paths.contains("id"));
    Assert.assertTrue(paths.contains("logger.infoEnabled"));
}

From source file:it.polimi.diceH2020.launcher.service.RestCommunicationWrapper.java

public RestCommunicationWrapper() {
    restTemplate = new RestTemplate();
    SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
    // To avoid running out of memory
    requestFactory.setBufferRequestBody(false);
    restTemplate.setRequestFactory(requestFactory);
}

From source file:com.opensearchserver.hadse.index.IndexTest.java

@Test
public void t01_deleteIndex() {
    HttpHeaders headers = new HttpHeaders();
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));

    RestTemplate template = new RestTemplate();

    ResponseEntity<String> entity = template.exchange("http://localhost:8080/my_index", HttpMethod.DELETE, null,
            String.class);
    assertNotNull(entity);/*from www.j a  v  a  2  s  . com*/
    HttpStatus res = entity.getStatusCode();
    assertNotNull(res);
    switch (res) {
    case OK:
        assertEquals(HttpStatus.OK, res);
        break;
    case NOT_FOUND:
        assertEquals(HttpStatus.NOT_FOUND, res);
        break;
    default:
        fail("Unexpected result: " + res);
        break;
    }
}

From source file:fi.helsinki.opintoni.config.PageMetadataConfiguration.java

@Bean
public RestTemplate metaDataRestTemplate() {
    RestTemplate template = new RestTemplate();
    template.getMessageConverters().add(0, new StringHttpMessageConverter(Charset.forName("UTF-8")));
    return template;
}

From source file:org.trustedanalytics.serviceexposer.checker.CheckerConfig.java

@Bean
protected RestOperations userRestTemplate() {
    return new RestTemplate();
}

From source file:com.vermeg.convertisseur.service.ConvServiceImpl.java

@Override
public File load(String id) {
    RestTemplate restTemplate = new RestTemplate();
    String req = "http://localhost:8080/archive/document/" + id;
    File file;/*from   w  w w .ja va  2  s  .co m*/
    return (restTemplate.getForObject(req, File.class));

}