Package javax.ws.rs.client

Examples of javax.ws.rs.client.WebTarget.path()


        final List<Queue<String>> receivedQueues = new ArrayList<Queue<String>>(MAX_LISTENERS);
        final EventSource[] sources = new EventSource[MAX_LISTENERS];

        for (int i = 0; i < MAX_LISTENERS; i++) {
            final int id = i;
            final EventSource es = EventSource.target(itemsTarget.path("events")).named("SOURCE " + id).build();
            sources[id] = es;

            final Queue<String> received = new ConcurrentLinkedQueue<String>();
            receivedQueues.add(received);
View Full Code Here


    @Test
    public void testGet() {

        final WebTarget target = target().path("producer");

        final Response fieldResponse = target.path("f").request().get();
        assertThat(fieldResponse.getStatus(), is(200));
        assertThat(fieldResponse.readEntity(String.class), is("field"));

        final Response methodResponse = target.path("m").request().get();
        assertThat(methodResponse.getStatus(), is(200));
View Full Code Here

        final Response fieldResponse = target.path("f").request().get();
        assertThat(fieldResponse.getStatus(), is(200));
        assertThat(fieldResponse.readEntity(String.class), is("field"));

        final Response methodResponse = target.path("m").request().get();
        assertThat(methodResponse.getStatus(), is(200));
        assertThat(methodResponse.readEntity(String.class), is("method"));
    }
}
View Full Code Here

    @Test
    public void testConstructorInjectedResource() {

        final WebTarget target = target().path("ctor-injected");

        final Response pathParamResponse = target.path("pathParam").request().get();
        assertThat(pathParamResponse.getStatus(), is(200));
        assertThat(pathParamResponse.readEntity(String.class), is("pathParam"));

        final Response queryParamResponse = target.path("queryParam").queryParam("q", "123").request().get();
        assertThat(queryParamResponse.getStatus(), is(200));
View Full Code Here

        final Response pathParamResponse = target.path("pathParam").request().get();
        assertThat(pathParamResponse.getStatus(), is(200));
        assertThat(pathParamResponse.readEntity(String.class), is("pathParam"));

        final Response queryParamResponse = target.path("queryParam").queryParam("q", "123").request().get();
        assertThat(queryParamResponse.getStatus(), is(200));
        assertThat(queryParamResponse.readEntity(String.class), is("123"));

        final Response matrixParamResponse = target.path("matrixParam").matrixParam("m", "456").request().get();
        assertThat(matrixParamResponse.getStatus(), is(200));
View Full Code Here

        final Response queryParamResponse = target.path("queryParam").queryParam("q", "123").request().get();
        assertThat(queryParamResponse.getStatus(), is(200));
        assertThat(queryParamResponse.readEntity(String.class), is("123"));

        final Response matrixParamResponse = target.path("matrixParam").matrixParam("m", "456").request().get();
        assertThat(matrixParamResponse.getStatus(), is(200));
        assertThat(matrixParamResponse.readEntity(String.class), is("456"));

        final Response headerParamResponse = target.path("headerParam").request().header("Custom-Header", "789").get();
        assertThat(headerParamResponse.getStatus(), is(200));
View Full Code Here

        final Response matrixParamResponse = target.path("matrixParam").matrixParam("m", "456").request().get();
        assertThat(matrixParamResponse.getStatus(), is(200));
        assertThat(matrixParamResponse.readEntity(String.class), is("456"));

        final Response headerParamResponse = target.path("headerParam").request().header("Custom-Header", "789").get();
        assertThat(headerParamResponse.getStatus(), is(200));
        assertThat(headerParamResponse.readEntity(String.class), is("789"));

        final Response cdiParamResponse = target.path("cdiParam").request().get();
        assertThat(cdiParamResponse.getStatus(), is(200));
View Full Code Here

        final Response headerParamResponse = target.path("headerParam").request().header("Custom-Header", "789").get();
        assertThat(headerParamResponse.getStatus(), is(200));
        assertThat(headerParamResponse.readEntity(String.class), is("789"));

        final Response cdiParamResponse = target.path("cdiParam").request().get();
        assertThat(cdiParamResponse.getStatus(), is(200));
        assertThat(cdiParamResponse.readEntity(String.class), is("cdi-produced"));
    }
}
View Full Code Here

        Response response;
        String responseBody;

        // account 12 -> insert 1000:
        response = cdiResourceNoRollback.path("12").request().put(Entity.text("1000"));
        assertThat(response.getStatus(), equalTo(200));

        // account 13 -> insert 1000:
        response = cdiResourceNoRollback.path("13").request().put(Entity.text("1000"));
        assertThat(response.getStatus(), equalTo(200));
View Full Code Here

        // account 12 -> insert 1000:
        response = cdiResourceNoRollback.path("12").request().put(Entity.text("1000"));
        assertThat(response.getStatus(), equalTo(200));

        // account 13 -> insert 1000:
        response = cdiResourceNoRollback.path("13").request().put(Entity.text("1000"));
        assertThat(response.getStatus(), equalTo(200));

        // transfer 1000 from 13 to 12:
        response = cdiResource.queryParam("from", "13").queryParam("to", "12").request().post(Entity.text("1000"));
        assertThat(response.getStatus(), equalTo(200));
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.