Package javax.ws.rs.client

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


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

        WebTarget r = ClientBuilder.newClient().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


        System.out.println("Client: GET " + Server.BASE_URI);

        WebTarget target = client.target(Server.BASE_URI);
        target.register(new LoggingFilter());

        final Response response = target.path("/").request().get(Response.class);

        assertEquals(200, response.getStatus());

        client.close();
    }
View Full Code Here

        WebTarget target = client.target(Server.BASE_URI);
        target.register(new LoggingFilter());

        Response response;

        response = target.path("/").request().get(Response.class);

        assertEquals(401, response.getStatus());

        client.close();
    }
View Full Code Here

        target.register(new LoggingFilter());

        boolean caught = false;

        try {
            target.path("/").request().get(String.class);
        } catch (Exception e) {
            caught = true;
        }

        assertTrue(caught);
View Full Code Here

        startServer(rc);

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

        assertEquals("one", r.path("one").request().get(String.class));
        assertEquals("one-sub", r.path("one/sub").request().get(String.class));
        assertEquals(404, r.path("two").request().get(Response.class).getStatus());

        // add Two resource
        reloader.reload(new ResourceConfig(One.class, Two.class));
View Full Code Here

        startServer(rc);

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

        assertEquals("one", r.path("one").request().get(String.class));
        assertEquals("one-sub", r.path("one/sub").request().get(String.class));
        assertEquals(404, r.path("two").request().get(Response.class).getStatus());

        // add Two resource
        reloader.reload(new ResourceConfig(One.class, Two.class));
View Full Code Here

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

        assertEquals("one", r.path("one").request().get(String.class));
        assertEquals("one-sub", r.path("one/sub").request().get(String.class));
        assertEquals(404, r.path("two").request().get(Response.class).getStatus());

        // add Two resource
        reloader.reload(new ResourceConfig(One.class, Two.class));

        assertEquals("one", r.path("one").request().get(String.class));
View Full Code Here

        assertEquals(404, r.path("two").request().get(Response.class).getStatus());

        // add Two resource
        reloader.reload(new ResourceConfig(One.class, Two.class));

        assertEquals("one", r.path("one").request().get(String.class));
        assertEquals("one-sub", r.path("one/sub").request().get(String.class));
        assertEquals("two", r.path("two").request().get(String.class));
    }

    static class StartStopListener extends AbstractContainerLifecycleListener {
View Full Code Here

        // add Two resource
        reloader.reload(new ResourceConfig(One.class, Two.class));

        assertEquals("one", r.path("one").request().get(String.class));
        assertEquals("one-sub", r.path("one/sub").request().get(String.class));
        assertEquals("two", r.path("two").request().get(String.class));
    }

    static class StartStopListener extends AbstractContainerLifecycleListener {
        volatile boolean started;
View Full Code Here

        // add Two resource
        reloader.reload(new ResourceConfig(One.class, Two.class));

        assertEquals("one", r.path("one").request().get(String.class));
        assertEquals("one-sub", r.path("one/sub").request().get(String.class));
        assertEquals("two", r.path("two").request().get(String.class));
    }

    static class StartStopListener extends AbstractContainerLifecycleListener {
        volatile boolean started;
        volatile boolean stopped;
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.