Package org.apache.wink.client

Examples of org.apache.wink.client.Resource


        ProxyAuthSecurityHandler proxyAuthSecurityHandler = new ProxyAuthSecurityHandler();
        proxyAuthSecurityHandler.setUserName("username");
        // oops, forgot to set password!
        config.handlers(proxyAuthSecurityHandler);
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL);
        try {
            @SuppressWarnings("unused")
            ClientResponse response = resource.get();
            fail("should have got a ClientAuthenticationException");
        } catch (ClientAuthenticationException e) {
            // do nothing
        }
    }
View Full Code Here


        ProxyAuthSecurityHandler proxyAuthSecurityHandler = new ProxyAuthSecurityHandler();
        // oops, forgot to set 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

     */
   
    public void testNoBasicAuthHandler() throws Exception {
        server.getMockHttpServerResponses().get(0).setMockResponseCode(401);
        RestClient client = new RestClient(new ClientConfig());
        Resource resource = client.resource(serviceURL);
        ClientResponse response = resource.get();
        assertEquals(401, response.getStatusCode())// should have challenged us due to lack of credentials
    }
View Full Code Here

        BasicAuthSecurityHandler basicAuthSecurityHandler = new BasicAuthSecurityHandler();
        basicAuthSecurityHandler.setUserName("username");
        basicAuthSecurityHandler.setPassword("password");
        config.handlers(basicAuthSecurityHandler);
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL);
        ClientResponse response = resource.get();
        assertEquals(200, response.getStatusCode());
    }
View Full Code Here

        BasicAuthSecurityHandler basicAuthSecurityHandler = new BasicAuthSecurityHandler();
        basicAuthSecurityHandler.setUserName("username");
        basicAuthSecurityHandler.setPassword("password");
        config.handlers(basicAuthSecurityHandler);
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL);
        try {
            @SuppressWarnings("unused")
            ClientResponse response = resource.get();
            fail("should have got a ClientAuthenticationException");
        } catch (ClientAuthenticationException e) {
            // do nothing
        }
    }
View Full Code Here

        BasicAuthSecurityHandler basicAuthSecurityHandler = new BasicAuthSecurityHandler();
        basicAuthSecurityHandler.setUserName("username");
        basicAuthSecurityHandler.setPassword("password");
        config.handlers(basicAuthSecurityHandler);
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL);
        ClientResponse response = resource.get();
        assertEquals(200, response.getStatusCode());
    }
View Full Code Here

     */
   
    public void testNoProxyAuthHandler() throws Exception {
        server.getMockHttpServerResponses().get(0).setMockResponseCode(407);
        RestClient client = new RestClient(new ClientConfig());
        Resource resource = client.resource(serviceURL);
        ClientResponse response = resource.get();
        assertEquals(407, response.getStatusCode())// should have challenged us due to lack of credentials
    }
View Full Code Here

        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

        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();
            fail("should have got a ClientAuthenticationException");
        } catch (ClientAuthenticationException e) {
            // do nothing
        }
    }
View Full Code Here

        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

TOP

Related Classes of org.apache.wink.client.Resource

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.