Example usage for org.apache.http.client.fluent Request Get

List of usage examples for org.apache.http.client.fluent Request Get

Introduction

In this page you can find the example usage for org.apache.http.client.fluent Request Get.

Prototype

public static Request Get(final String uri) 

Source Link

Usage

From source file:org.ow2.proactive.addons.webhook.service.ApacheHttpClientRequestGetter.java

public Request getHttpRequestByString(String method, String url) {
    switch (method) {
    case "GET":
        return Request.Get(url);
    case "POST":
        return Request.Post(url);
    case "HEAD":
        return Request.Head(url);
    case "PUT":
        return Request.Put(url);
    case "DELETE":
        return Request.Delete(url);
    case "OPTIONS":
        return Request.Options(url);
    case "TRACE":
        return Request.Trace(url);
    default:/*from ww  w. j av  a  2s . com*/
        throw new IllegalArgumentException(method + " is not supported as a rest method");
    }
}

From source file:io.gravitee.gateway.standalone.NotFoundGatewayTest.java

@Test
public void call_no_api() throws IOException {
    Request request = Request.Get("http://localhost:8082/unknow");
    Response response = request.execute();
    HttpResponse returnResponse = response.returnResponse();

    assertEquals(HttpStatusCode.NOT_FOUND_404, returnResponse.getStatusLine().getStatusCode());
}

From source file:org.vertx.golo.HelloTestCase.java

@Test
public void testFoo() throws Exception {
    Response response = Request.Get("http://localhost:8080/").execute();
    String expected = "GoloGolo from vert.x!";
    String content = response.returnContent().asString();
    Assert.assertTrue("Was expecting " + content + " to contain " + expected, content.contains(expected));
}

From source file:nl.mawoo.wcmscript.modules.webrequest.WebRequest.java

/**
 * GET web request using the apache library
 *
 * NOTE: this method starts with a capital because end-users can use the libraries documentation.
 * Documentation can be found at: https://hc.apache.org/httpcomponents-client-ga/tutorial/html/fluent.html
 * @param request url you want to send a get request to
 * @return return REQUEST object//from   w ww  . ja va  2  s.  c  o m
 */
public Request get(String request) {
    return Request.Get(request);
}

From source file:org.wildfly.swarm.microprofile.metrics.registry.NoAcceptHeadersTest.java

@Test
@RunAsClient/*  w  w w. j a v a 2  s  .c om*/
public void shouldGetMetricsWithoutAcceptHeadersSet() throws IOException {
    Response response = Request.Get("http://localhost:8080/metrics").execute();
    assertThat(response.returnResponse().getStatusLine().getStatusCode()).isEqualTo(200);
}

From source file:org.wildfly.swarm.servlet.jpa.jta.test.ServletJpaJtaTest.java

@Test
@RunAsClient/* w w  w . j a v a2 s  . c  om*/
@InSequence(1)
public void empty() throws IOException {
    String result = Request.Get("http://localhost:8080/").execute().returnContent().asString().trim();
    assertThat(result).isEmpty();
}

From source file:org.adridadou.ethereum.swarm.SwarmService.java

public String get(final SwarmHash hash) throws IOException {
    Response response = Request.Get(host + "/bzzr:/" + hash.toString()).execute();

    return response.returnContent().asString();
}

From source file:com.triage.radium.testweb.it.ITTestWeb.java

@Test
public void testThatEchoServletReturnsUnsanitizedContent() throws Exception {
    String unsanitizedInput = "<xml>Unsantized!</xml>";
    URI uri = new URIBuilder(WEBAPP_BASE_URL + "/echo").addParameter("in", unsanitizedInput).build();
    Response resp = Request.Get(uri).execute();
    String resultText = resp.returnContent().toString().trim();

    assertEquals(resultText, "SUCCESS\n" + unsanitizedInput);

}

From source file:org.wildfly.swarm.datasources.defaultds.test.DefaultDatasourceTest.java

@Test
@RunAsClient/*from www .  j  a  v a 2  s .  co  m*/
public void testDefaultDatasource() throws IOException {
    String result = Request.Get("http://localhost:8080/").execute().returnContent().asString().trim();
    assertThat(result).isEqualTo("Default DataSource present: true");
}