Package javax.ws.rs.client

Examples of javax.ws.rs.client.Client


        poolingClientConnectionManager.setMaxTotal(configuration.getMaxTotalThread());
        poolingClientConnectionManager.setDefaultMaxPerRoute(configuration.getDefaultMaxPerRoute());

        clientConfig.property(ApacheClientProperties.CONNECTION_MANAGER, poolingClientConnectionManager);

        Client client = ClientBuilder.newBuilder()
                .register(JacksonFeature.class)
                .withConfig(clientConfig)
                .build();

        return client;
View Full Code Here


    @Before
    public void setUp() throws Exception {
        // start the server
        server = Main.startServer();
        // create the client
        Client c = ClientBuilder.newClient();

        // uncomment the following line if you want to enable
        // support for JSON in the client (you also have to uncomment
        // dependency on jersey-media-json module in pom.xml and Main.startServer())
        // --
        // c.configuration().enable(new org.glassfish.jersey.media.json.JsonJaxbFeature());

        target = c.target(Main.BASE_URI);
    }
View Full Code Here

    }
   
    @Test
    public void testGetBookSpec() {
        String address = "http://localhost:" + PORT + "/bookstore/bookheaders/simple";
        Client client = ClientBuilder.newClient();
        client.register((Object)ClientFilterClientAndConfigCheck.class);
        client.property("clientproperty", "somevalue");
        Book book = client.target(address).request("application/xml").get(Book.class);
        assertEquals(124L, book.getId());
    }
View Full Code Here

    }
   
    @Test
    public void testGetBookSpecProvider() {
        String address = "http://localhost:" + PORT + "/bookstore/bookheaders/simple";
        Client client = ClientBuilder.newClient();
        client.register(new BookInfoReader());
        BookInfo book = client.target(address)
            .request("application/xml").get(BookInfo.class);
        assertEquals(124L, book.getId());
    }
View Full Code Here

    }
   
    @Test
    public void testGetBookWebTargetProvider() {
        String address = "http://localhost:" + PORT + "/bookstore/bookheaders";
        Client client = ClientBuilder.newClient();
        client.register(new BookInfoReader());
        BookInfo book = client.target(address).path("simple")
            .request("application/xml").get(BookInfo.class);
        assertEquals(124L, book.getId());
       
    }
View Full Code Here

    @Test
    @RunAsClient
    public void crudViaRest() throws URISyntaxException {
        assertNotNull(url);

        Client client = ClientBuilder.newClient()
                .register(new FpEntityCollectionReaderWriter())
                .register(new FpEntityReaderWriter());
        WebTarget target = client.target(url.toURI()).path("rest").path("posts");

        // Create Post
        Response response = target.request().accept(MediaType.APPLICATION_JSON).get();
        assertNotNull(response);
        assertNotNull(response.readEntity(String.class));
View Full Code Here

       
        KeyStore keyStore = loadStore("src/test/java/org/apache/cxf/systest/http/resources/Morpit.jks",
            "password");
        builder.keyStore(keyStore, "password");
       
        Client client = builder.build();
       
        WebTarget target = client.target("https://localhost:" + PORT + "/bookstore/securebooks/123");
        Book b = target.request().accept(MediaType.APPLICATION_XML_TYPE).get(Book.class);
        assertEquals(123, b.getId());
    }
View Full Code Here

        builder.sslContext(sslContext);
       
        builder.hostnameVerifier(CertificateHostnameVerifier.ALLOW_ALL);
       
       
        Client client = builder.build();
       
        WebTarget target = client.target("https://localhost:" + PORT + "/bookstore/securebooks/123");
        Book b = target.request().accept(MediaType.APPLICATION_XML_TYPE).get(Book.class);
        assertEquals(123, b.getId());
    }
View Full Code Here

                    strings.get("internal", e.getMessage()), e);
        }
    }

    private static Client createClient() {
        Client c = JerseyClientFactory.newClient();
        c.configuration()
            .register(new MultiPartFeature())
            .register(new CsrfProtectionFilter("CLI"))
            .register(new ActionReportJsonReader())
            .register(new ParameterMapFormWriter())
            .register(new PayloadPartProvider())
View Full Code Here

    public static void preinit() {
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Client c = createClient();
                    c.target("http://localhost:4848");
                } catch (Throwable th) {
                }
                try {
                    createStandardSslContext(System.console() != null);
                } catch (Throwable th) {
View Full Code Here

TOP

Related Classes of javax.ws.rs.client.Client

Copyright © 2018 www.massapicom. 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.