Examples of handlers()


Examples of org.apache.wink.client.ClientConfig.handlers()

        server.getMockHttpServerResponses().get(0).setMockResponseCode(200);
        ClientConfig config = new ClientConfig();
        ProxyAuthSecurityHandler proxyAuthSecurityHandler = new ProxyAuthSecurityHandler();
        proxyAuthSecurityHandler.setUserName("username");
        proxyAuthSecurityHandler.setPassword("password");
        config.handlers(proxyAuthSecurityHandler);
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL);
        ClientResponse response = resource.get();
        assertEquals(200, response.getStatusCode());
    }
View Full Code Here

Examples of org.apache.wink.client.ClientConfig.handlers()

        server.setMockHttpServerResponses(response1, response2);
        ClientConfig config = new ClientConfig();
        ProxyAuthSecurityHandler proxyAuthSecurityHandler = new ProxyAuthSecurityHandler();
        proxyAuthSecurityHandler.setUserName("username");
        proxyAuthSecurityHandler.setPassword("password");
        config.handlers(proxyAuthSecurityHandler);
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL);
        try {
            @SuppressWarnings("unused")
            ClientResponse response = resource.get();
View Full Code Here

Examples of org.apache.wink.client.ClientConfig.handlers()

        server.setMockHttpServerResponses(response1, response2);
        ClientConfig config = new ClientConfig();
        ProxyAuthSecurityHandler proxyAuthSecurityHandler = new ProxyAuthSecurityHandler();
        proxyAuthSecurityHandler.setUserName("username");
        proxyAuthSecurityHandler.setPassword("password");
        config.handlers(proxyAuthSecurityHandler);
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL);
        ClientResponse response = resource.get();
        assertEquals(200, response.getStatusCode());
    }
View Full Code Here

Examples of org.apache.wink.client.ClientConfig.handlers()

        basicAuthSecurityHandler.setUserName("basicuser");
        basicAuthSecurityHandler.setPassword("basicpassword");
        ProxyAuthSecurityHandler proxyAuthSecurityHandler = new ProxyAuthSecurityHandler();
        proxyAuthSecurityHandler.setUserName("username");
        proxyAuthSecurityHandler.setPassword("password");
        config.handlers(proxyAuthSecurityHandler, basicAuthSecurityHandler)// proxy first, then basic, of course
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL);
        ClientResponse response = resource.get();
        assertEquals(200, response.getStatusCode());
    }
View Full Code Here

Examples of org.apache.wink.client.ClientConfig.handlers()

    public void testHandlers() {
        server.setMockResponseCode(200);
        server.setMockResponseContent(SENT_MESSAGE);

        ClientConfig config = new ClientConfig();
        config.handlers(new DummyHandler());
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL + "/testResourcePost");
        ClientResponse response =
            resource.contentType("text/plain").accept("text/plain")
                .post(SENT_MESSAGE.toLowerCase());
View Full Code Here

Examples of org.apache.wink.client.ClientConfig.handlers()

            config.proxyHost(cliHelper.getProxyHost());
            config.proxyPort(Integer.valueOf(cliHelper.getProxyPort()));
        }

        // add google authentication handler
        config.handlers(new GoogleAuthHandler(cliHelper.getEmail(), cliHelper.getPassword()));
        restClient = new RestClient(config);
        this.cliHelper = cliHelper;
    }

    private void run() {
View Full Code Here

Examples of org.apache.wink.client.ClientConfig.handlers()

    /**
     * Tests that a regular encoded input is acceptable to the server.
     */
    public void testContentEncodedInboundRequestRegularOutboundPost() {
        ClientConfig config = new ClientConfig();
        config.handlers();
        RestClient client = new RestClient(config);
        ClientResponse response =
            client.resource(getBaseURI() + "/regular/echo").post(getRepeatedString());
        assertEquals(200, response.getStatusCode());
        assertEquals(getRepeatedString(), response.getEntity(String.class));
View Full Code Here

Examples of org.apache.wink.client.ClientConfig.handlers()

    /**
     * Tests that a GZIP inbound is ok and outbound is also ok.
     */
    public void testGZIPContentEncodedInboundRequestContentEncodedOutboundPost() {
        ClientConfig config = new ClientConfig();
        config.handlers(new DeflateHandler());
        RestClient client = new RestClient(config);
        ClientResponse response =
            client.resource(getBaseURI() + "/contentencode/echo").post(getRepeatedString());

        assertEquals(200, response.getStatusCode());
View Full Code Here

Examples of org.apache.wink.client.ClientConfig.handlers()

    /**
     * Tests that a deflate inbound is ok and outbound is also ok.
     */
    public void testDeflatedContentEncodedInboundRequestContentEncodedOutboundPost() {
        ClientConfig config = new ClientConfig();
        config.handlers(new DeflateHandler());
        RestClient client = new RestClient(config);
        ClientResponse response =
            client.resource(getBaseURI() + "/contentencode/echo").post(getRepeatedString());

        assertEquals(200, response.getStatusCode());
View Full Code Here

Examples of org.apache.wink.client.ClientConfig.handlers()

        /*
         * test even with the GZIP Handler on the path
         */
        ClientConfig clientConfig = new ClientConfig();
        clientConfig.handlers(new GzipHandler());
        client = new RestClient(clientConfig);

        response = client.resource(getBaseURI() + "/regular/repeatedstring").get();
        verifyResponseNotContentEncodedForRepeatedStrings(response);
    }
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.