Package javax.ws.rs.client

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


    @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();
    }

    @Test
View Full Code Here


        assertEquals("GET", r.request().get(String.class));

        assertEquals("POST", r.request().post(Entity.text("POST"), String.class));

        assertEquals(204, r.path("noproduce").request().post(Entity.text("POST")).getStatus());

        assertEquals(204, r.path("noconsumeproduce").request().post(null).getStatus());

        assertEquals("PUT", r.request().post(Entity.text("PUT"), String.class));
View Full Code Here

        assertEquals("POST", r.request().post(Entity.text("POST"), String.class));

        assertEquals(204, r.path("noproduce").request().post(Entity.text("POST")).getStatus());

        assertEquals(204, r.path("noconsumeproduce").request().post(null).getStatus());

        assertEquals("PUT", r.request().post(Entity.text("PUT"), String.class));

        assertEquals("DELETE", r.request().delete(String.class));
    }
View Full Code Here

        client.register(HttpAuthenticationFeature.basic("user", "password"));

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

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

        assertEquals(200, response.getStatus());
    }

    /**
 
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());
    }

    /**
 
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

        String s;


        // check that the regular filter gets involved
        s = target.path("direct").request().get(String.class);
        Assert.assertEquals("[DIRECT]", s);

        // the regular filter should work for directly requested forward resource as well.
        s = target.path("forward").request().get(String.class);
        Assert.assertEquals("[FORWARD]", s);
View Full Code Here

        // check that the regular filter gets involved
        s = target.path("direct").request().get(String.class);
        Assert.assertEquals("[DIRECT]", s);

        // the regular filter should work for directly requested forward resource as well.
        s = target.path("forward").request().get(String.class);
        Assert.assertEquals("[FORWARD]", s);

        // forward action should enforce forward filter to be invoked
        s = target.queryParam("action", "forward").request().get(String.class);
        Assert.assertEquals(">>FORWARD", s);
View Full Code Here

        // forward action should enforce forward filter to be invoked
        s = target.queryParam("action", "forward").request().get(String.class);
        Assert.assertEquals(">>FORWARD", s);

        // direct call to the include resource
        s = target.path("included").request().get(String.class);
        Assert.assertEquals("[INCLUDED]", s);

        // include call should involve both regular and include filter
        s = target.path("included").queryParam("action", "include").request().get(String.class);
        Assert.assertEquals("[SOMETHING INCLUDED]", s);
View Full Code Here

        // direct call to the include resource
        s = target.path("included").request().get(String.class);
        Assert.assertEquals("[INCLUDED]", s);

        // include call should involve both regular and include filter
        s = target.path("included").queryParam("action", "include").request().get(String.class);
        Assert.assertEquals("[SOMETHING INCLUDED]", s);
    }
}
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.