Package org.springframework.http.client

Examples of org.springframework.http.client.SimpleClientHttpRequestFactory.createRequest()


        factory.setConnectTimeout(15 * 1000);
        factory.setReadTimeout(15 * 1000);

        URI uri = new URI("http://localhost:" + TEST_PORT + "/testConnectionFactory");
        HttpMethod method = HttpMethod.GET;
        ClientHttpRequest request = factory.createRequest(uri, method);
        ClientHttpResponse response = request.execute();
        assertEquals("Mismatched response code", HttpStatus.OK.value(), response.getRawStatusCode());

        BufferedReader rdr = new BufferedReader(new InputStreamReader(response.getBody()));
        try {
View Full Code Here


  }

  private void doTest(AnnotationConfigEmbeddedWebApplicationContext context,
      String resourcePath) throws Exception {
    SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory();
    ClientHttpRequest request = clientHttpRequestFactory.createRequest(new URI(
        "http://localhost:" + context.getEmbeddedServletContainer().getPort()
            + resourcePath), HttpMethod.GET);
    ClientHttpResponse response = request.execute();
    try {
      String actual = StreamUtils.copyToString(response.getBody(),
View Full Code Here

    assertContent("/endpoint", ports.get().management, null);
  }

  public void assertContent(String url, int port, Object expected) throws Exception {
    SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory();
    ClientHttpRequest request = clientHttpRequestFactory.createRequest(new URI(
        "http://localhost:" + port + url), HttpMethod.GET);
    try {
      ClientHttpResponse response = request.execute();
      try {
        String actual = StreamUtils.copyToString(response.getBody(),
View Full Code Here

    }
  }

  public boolean hasHeader(String url, int port, String header) throws Exception {
    SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory();
    ClientHttpRequest request = clientHttpRequestFactory.createRequest(new URI(
        "http://localhost:" + port + url), HttpMethod.GET);
    ClientHttpResponse response = request.execute();
    return response.getHeaders().containsKey(header);
  }
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.