Package javax.ws.rs.client

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


        startServer(new ResourceConfig(One.class).register(listener));

        Client client = ClientBuilder.newClient();
        WebTarget r = client.target(getUri().path("/").build());

        assertThat(r.path("one").request().get(String.class), equalTo("one"));
        assertThat(r.path("two").request().get(Response.class).getStatus(), equalTo(404));

        stopServer();

        assertTrue("ContainerLifecycleListener.onStartup has not been called.", listener.started);
View Full Code Here


        Client client = ClientBuilder.newClient();
        WebTarget r = client.target(getUri().path("/").build());

        assertThat(r.path("one").request().get(String.class), equalTo("one"));
        assertThat(r.path("two").request().get(Response.class).getStatus(), equalTo(404));

        stopServer();

        assertTrue("ContainerLifecycleListener.onStartup has not been called.", listener.started);
        assertTrue("ContainerLifecycleListener.onShutdown has not been called.", listener.stopped);
View Full Code Here

    };

    private WebTarget prepareTarget(String path) {
        final WebTarget target = target();
        target.register(LoggingFilter.class);
        return target.path(path);
    }

    @Test
    public void testProgrammaticApp() throws Exception {
        Response response = prepareTarget(ROOT_PATH_PROGRAMMATIC).request("text/plain").method(TRACE.NAME);
View Full Code Here

    }

    private void _testTraceWithEntity(final boolean isAsync, final boolean useJettyConnection) throws Exception {
        try {
            WebTarget target = useJettyConnection ? getJettyClient().target(target().getUri()) : target();
            target = target.path(ROOT_PATH_ANNOTATED);

            final Entity<String> entity = Entity.entity("trace", MediaType.WILDCARD_TYPE);

            Response response;
            if (!isAsync) {
View Full Code Here

        startServer(rc);

        WebTarget r = ClientBuilder.newClient().target(getUri().path("/").build());

        assertEquals("test", r.path("packageTest").request().get(String.class));
        assertEquals("test-sub", r.path("packageTest/sub").request().get(String.class));
        assertEquals(404, r.path("wrong").request().get(Response.class).getStatus());

    }
}
View Full Code Here

        startServer(rc);

        WebTarget r = ClientBuilder.newClient().target(getUri().path("/").build());

        assertEquals("test", r.path("packageTest").request().get(String.class));
        assertEquals("test-sub", r.path("packageTest/sub").request().get(String.class));
        assertEquals(404, r.path("wrong").request().get(Response.class).getStatus());

    }
}
View Full Code Here

        WebTarget r = ClientBuilder.newClient().target(getUri().path("/").build());

        assertEquals("test", r.path("packageTest").request().get(String.class));
        assertEquals("test-sub", r.path("packageTest/sub").request().get(String.class));
        assertEquals(404, r.path("wrong").request().get(Response.class).getStatus());

    }
}
View Full Code Here

    }

    @Test
    public void testPostNoProduce() {
        WebTarget r = getWebTarget();
        assertEquals(204, r.path("noproduce").request().post(Entity.text("POST")).getStatus());

        Response cr = r.path("noproduce").request().post(Entity.text("POST"));
        assertFalse(cr.hasEntity());
        cr.close();
    }
View Full Code Here

    @Test
    public void testPostNoProduce() {
        WebTarget r = getWebTarget();
        assertEquals(204, r.path("noproduce").request().post(Entity.text("POST")).getStatus());

        Response cr = r.path("noproduce").request().post(Entity.text("POST"));
        assertFalse(cr.hasEntity());
        cr.close();
    }

View Full Code Here


    @Test
    public void testPostNoConsumeProduce() {
        WebTarget r = getWebTarget();
        assertEquals(204, r.path("noconsumeproduce").request().post(null).getStatus());

        Response cr = r.path("noconsumeproduce").request().post(Entity.text("POST"));
        assertFalse(cr.hasEntity());
        cr.close();
    }
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.