Package org.glassfish.jersey.client

Examples of org.glassfish.jersey.client.ClientConfig$State$StateChangeStrategy


        return new ResourceConfig(Resource.class);
    }

    @Test
    public void testClientWithProviderClasses() {
        Client client = ClientBuilder.newClient(new ClientConfig(ClientFilterConstrainedToServer.class,
                ClientFilterConstrainedToClient.class, ClientFilter.class));

        _testFilters(client);
    }
View Full Code Here


        _testFilters(client);
    }

    @Test
    public void testClientWithProviderInstances() {
        Client client = ClientBuilder.newClient(new ClientConfig(new ClientFilterConstrainedToServer(),
                new ClientFilterConstrainedToClient(), new ClientFilter()));

        _testFilters(client);
    }
View Full Code Here

        return new ResourceConfig(Resource.class);
    }

    @Test
    public void testCustomExecutorsAsync() throws ExecutionException, InterruptedException {
        ClientConfig jerseyConfig = new ClientConfig();
        jerseyConfig.register(CustomExecutorProvider.class).register(ThreadInterceptor.class);
        Client client = ClientBuilder.newClient(jerseyConfig);
        runCustomExecutorTestAsync(client);
    }
View Full Code Here

        runCustomExecutorTestAsync(client);
    }

    @Test
    public void testCustomExecutorsInstanceAsync() throws ExecutionException, InterruptedException {
        ClientConfig jerseyConfig = new ClientConfig();
        jerseyConfig.register(new CustomExecutorProvider()).register(ThreadInterceptor.class);
        Client client = ClientBuilder.newClient(jerseyConfig);
        runCustomExecutorTestAsync(client);
    }
View Full Code Here

    }


    @Test
    public void testCustomExecutorsSync() throws ExecutionException, InterruptedException {
        ClientConfig jerseyConfig = new ClientConfig();
        jerseyConfig.register(CustomExecutorProvider.class).register(ThreadInterceptor.class);
        Client client = ClientBuilder.newClient(jerseyConfig);
        runCustomExecutorTestSync(client);
    }
View Full Code Here

    }


    @Test
    public void testCustomExecutorsInstanceSync() throws ExecutionException, InterruptedException {
        ClientConfig jerseyConfig = new ClientConfig();
        jerseyConfig.register(new CustomExecutorProvider()).register(ThreadInterceptor.class);
        Client client = ClientBuilder.newClient(jerseyConfig);
        runCustomExecutorTestSync(client);
    }
View Full Code Here

        }
    }

    @Test
    public void testPost() {
        ClientConfig cc = new ClientConfig(GZipEncoder.class);
        cc.connectorProvider(new ApacheConnectorProvider());
        Client client = ClientBuilder.newClient(cc);
        WebTarget r = client.target(getBaseUri());

        byte[] content = new byte[1024 * 1024];
        assertTrue(Arrays.equals(content, r.request().post(Entity.entity(content, MediaType.APPLICATION_OCTET_STREAM_TYPE)).readEntity(byte[].class)));
View Full Code Here

        cr.close();
    }

    @Test
    public void testPostChunked() {
        ClientConfig cc = new ClientConfig(GZipEncoder.class);
        cc.property(ClientProperties.CHUNKED_ENCODING_SIZE, 1024);
        cc.connectorProvider(new ApacheConnectorProvider());
        Client client = ClientBuilder.newClient(cc);

        WebTarget r = client.target(getBaseUri());

        byte[] content = new byte[1024 * 1024];
 
View Full Code Here

        credentialsProvider.setCredentials(
                AuthScope.ANY,
                new UsernamePasswordCredentials("name", "password")
        );

        ClientConfig cc = new ClientConfig();
        cc.property(ApacheClientProperties.CREDENTIALS_PROVIDER, credentialsProvider).property(ApacheClientProperties.PREEMPTIVE_BASIC_AUTHENTICATION, true);
        cc.connectorProvider(new ApacheConnectorProvider());
        Client client = ClientBuilder.newClient(cc);

        WebTarget r = client.target(getBaseUri());
        assertEquals("GET", r.request().get(String.class));
    }
View Full Code Here

        credentialsProvider.setCredentials(
                AuthScope.ANY,
                new UsernamePasswordCredentials("name", "password")
        );

        ClientConfig cc = new ClientConfig();
        cc.property(ApacheClientProperties.CREDENTIALS_PROVIDER, credentialsProvider)
                .property(ApacheClientProperties.PREEMPTIVE_BASIC_AUTHENTICATION, true);
        cc.connectorProvider(new ApacheConnectorProvider());
        Client client = ClientBuilder.newClient(cc);

        WebTarget r = client.target(getBaseUri());
        assertEquals("POST", r.request().post(Entity.text("POST"), String.class));
    }
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.client.ClientConfig$State$StateChangeStrategy

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.