Package org.apache.cxf.jaxrs.client

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


   
    private void getBookAegis(String endpointAddress, String type, String mHeader) throws Exception {
        WebClient client = WebClient.create(endpointAddress,
            Collections.singletonList(new AegisElementProvider<Object>()));
        if (mHeader != null) {
            client = client.header("X-HTTP-Method-Override", mHeader);
        }
        Book book = client.accept(type).get(Book.class);

        assertEquals(124L, book.getId());
        assertEquals("CXF in Action - 2", book.getName());
View Full Code Here


   
    @Test
    public void testPostBookNewMediaType() {
        String address = "http://localhost:" + PORT + "/bookstore/bookheaders/simple";
        WebClient wc = createWebClientPost(address);
        wc.header("newmediatype", "application/v1+xml");
        Book book = wc.post(new Book("Book", 126L), Book.class);
        assertEquals(124L, book.getId());
        validatePostResponse(wc);
        assertEquals("application/v1+xml", wc.getResponse().getHeaderString("newmediatypeused"));
    }
View Full Code Here

   
   
    @Test
    public void testOnewayWebClient() throws Exception {
        WebClient client = WebClient.create("http://localhost:" + PORT + "/bookstore/oneway");
        Response r = client.header("OnewayRequest", "true").post(null);
        assertEquals(202, r.getStatus());
    }
   
    @Test
    public void testBookWithSpace() throws Exception {
View Full Code Here

        assertEquals("123", headers.getFirst("BookId"));
        assertEquals(MultivaluedMap.class.getName(), headers.getFirst("MAP-NAME"));
       
        assertNotNull(headers.getFirst("Date"));
       
        wc.header("PLAIN-MAP", "true");
        b = wc.get(Book.class);
        assertEquals(123L, b.getId());
       
        headers = wc.getResponse().getMetadata();
        assertEquals("321", headers.getFirst("BookId"));
View Full Code Here

   
   
    @Test
    public void testOnewayWebClient() throws Exception {
        WebClient client = WebClient.create("http://localhost:" + PORT + "/bookstore/oneway");
        Response r = client.header("OnewayRequest", "true").post(null);
        assertEquals(202, r.getStatus());
    }
   
    @Test
    public void testBookWithSpace() throws Exception {
View Full Code Here

        assertEquals("123", headers.getFirst("BookId"));
        assertEquals(MultivaluedMap.class.getName(), headers.getFirst("MAP-NAME"));
       
        assertNotNull(headers.getFirst("Date"));
       
        wc.header("PLAIN-MAP", "true");
        b = wc.get(Book.class);
        assertEquals(123L, b.getId());
       
        headers = wc.getResponse().getMetadata();
        assertEquals("321", headers.getFirst("BookId"));
View Full Code Here

   
   
    @Test
    public void testOnewayWebClient() throws Exception {
        WebClient client = WebClient.create("http://localhost:" + PORT + "/bookstore/oneway");
        Response r = client.header("OnewayRequest", "true").post(null);
        assertEquals(202, r.getStatus());
    }
   
    @Test
    public void testBookWithSpace() throws Exception {
View Full Code Here

   
    private void getBookAegis(String endpointAddress, String type, String mHeader) throws Exception {
        WebClient client = WebClient.create(endpointAddress,
            Collections.singletonList(new AegisElementProvider()));
        if (mHeader != null) {
            client = client.header("X-HTTP-Method-Override", mHeader);
        }
        Book book = client.accept(type).get(Book.class);

        assertEquals(124L, book.getId());
        assertEquals("CXF in Action - 2", book.getName());
View Full Code Here

   
    private void getBookAegis(String endpointAddress, String type, String mHeader) throws Exception {
        WebClient client = WebClient.create(endpointAddress,
            Collections.singletonList(new AegisElementProvider()));
        if (mHeader != null) {
            client = client.header("X-HTTP-Method-Override", mHeader);
        }
        Book book = client.accept(type).get(Book.class);

        assertEquals(124L, book.getId());
        assertEquals("CXF in Action - 2", book.getName());
View Full Code Here

   
    @Test
    public void testGetBook123Fail() throws Exception {
        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstore/books/123");
        wc.accept("text/xml");
        wc.header("fail-write", "");
        Response r = wc.get();
        assertEquals(500, r.getStatus());
    }
   
    @Test
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.