Package org.apache.cxf.jaxrs.client

Examples of org.apache.cxf.jaxrs.client.WebClient.path()


    public void testWebClientUnwrapBookWithXslt() throws Exception {
        XSLTJaxbProvider provider = new XSLTJaxbProvider();
        provider.setInTemplate("classpath:/org/apache/cxf/systest/jaxrs/resources/unwrapbook.xsl");
        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstore/books/wrapper",
                             Collections.singletonList(provider));
        wc.path("{id}", 123);
        Book book = wc.get(Book.class);
        assertNotNull(book);
        assertEquals(123L, book.getId());
       
    }
View Full Code Here


    public void testWebClientUnwrapBookWithXslt() throws Exception {
        XSLTJaxbProvider provider = new XSLTJaxbProvider();
        provider.setInTemplate("classpath:/org/apache/cxf/systest/jaxrs/resources/unwrapbook.xsl");
        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstore/books/wrapper",
                             Collections.singletonList(provider));
        wc.path("{id}", 123);
        Book book = wc.get(Book.class);
        assertNotNull(book);
        assertEquals(123L, book.getId());
       
    }
View Full Code Here

    public void testWebClientUnwrapBookWithXslt() throws Exception {
        XSLTJaxbProvider provider = new XSLTJaxbProvider();
        provider.setInTemplate("classpath:/org/apache/cxf/systest/jaxrs/resources/unwrapbook.xsl");
        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstore/books/wrapper",
                             Collections.singletonList(provider));
        wc.path("{id}", 123);
        Book book = wc.get(Book.class);
        assertNotNull(book);
        assertEquals(123L, book.getId());
       
    }
View Full Code Here

       
        WebClient wc = (WebClient)cfb.create();
        assertEquals("https://localhost:" + PORT, wc.getBaseURI().toString());
       
        wc.accept("application/xml");
        wc.path("bookstore/securebooks/123");
        TheBook b = wc.get(TheBook.class);
       
        assertEquals(b.getId(), 123);
        b = wc.get(TheBook.class);
        assertEquals(b.getId(), 123);
View Full Code Here

        BookStore bs = JAXRSClientFactory.create("https://localhost:" + PORT, BookStore.class,
                                                 CLIENT_CONFIG_FILE1);
        Book b = bs.getSecureBook("123");
        assertEquals(b.getId(), 123);
        WebClient wc = WebClient.fromClient(WebClient.client(bs));
        wc.path("/bookstore/securebooks/123").accept(MediaType.APPLICATION_XML_TYPE);
        Book b2 = wc.get(Book.class);
        assertEquals(123, b2.getId());
    }
   
   
View Full Code Here

   
    @Test
    public void testGetBook123WebClientToProxy() throws Exception {
       
        WebClient wc = WebClient.create("https://localhost:" + PORT, CLIENT_CONFIG_FILE1);
        wc.path("/bookstore/securebooks/123").accept(MediaType.APPLICATION_XML_TYPE);
        Book b = wc.get(Book.class);
        assertEquals(123, b.getId());
       
        wc.back(true);
       
View Full Code Here

   
    private void doTestGetBook123WebClient(String configFile) throws Exception {
        WebClient client = WebClient.create("https://localhost:" + PORT, configFile);
        assertEquals("https://localhost:" + PORT, client.getBaseURI().toString());
       
        client.path("/bookstore/securebooks/123").accept(MediaType.APPLICATION_XML_TYPE);
        Book b = client.get(Book.class);
        assertEquals(123, b.getId());
    }    
    @XmlRootElement(name = "TheBook")
View Full Code Here

             + "&replyToName=dynamicQueues/test.jmstransport.response"
             + "&jndiURL=tcp://localhost:" + JMS_PORT
             + "&jndiConnectionFactoryName=ConnectionFactory";
              
        WebClient client = WebClient.create(endpointAddressUrlEncoded);
        client.path("bookstore").path("books").path("123");
       
        Book book = client.get(Book.class);
        assertEquals("Get a wrong response code.", 200, client.getResponse().getStatus());
        assertEquals("Get a wrong book id.", 123, book.getId());
    }
View Full Code Here

        assertEquals("https://localhost:" + PORT, WebClient.client(bs).getBaseURI().toString());
       
        WebClient wc = WebClient.fromClient(WebClient.client(bs));
        assertEquals("https://localhost:" + PORT, WebClient.client(bs).getBaseURI().toString());
        wc.accept("application/xml");
        wc.path("bookstore/securebooks/123");
        TheBook b = wc.get(TheBook.class);
       
        assertEquals(b.getId(), 123);
        b = wc.get(TheBook.class);
        assertEquals(b.getId(), 123);
View Full Code Here

       
        WebClient wc = (WebClient)cfb.create();
        assertEquals("https://localhost:" + PORT, wc.getBaseURI().toString());
       
        wc.accept("application/xml");
        wc.path("bookstore/securebooks/123");
        TheBook b = wc.get(TheBook.class);
       
        assertEquals(b.getId(), 123);
        b = wc.get(TheBook.class);
        assertEquals(b.getId(), 123);
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.