Search in sources :

Example 6 with Booking

use of org.apache.karaf.examples.rest.api.Booking in project karaf by apache.

the class ListBookingCommand method execute.

@Override
public Object execute() throws Exception {
    List providers = new ArrayList();
    providers.add(new JacksonJsonProvider());
    WebClient webClient = WebClient.create(restLocation, providers);
    List<Booking> bookings = (List<Booking>) webClient.accept(MediaType.APPLICATION_JSON).getCollection(Booking.class);
    for (Booking booking : bookings) {
        System.out.println(booking.getId() + " " + booking.getCustomer() + " " + booking.getFlight());
    }
    return null;
}
Also used : JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) Booking(org.apache.karaf.examples.rest.api.Booking) WebClient(org.apache.cxf.jaxrs.client.WebClient)

Aggregations

Booking (org.apache.karaf.examples.rest.api.Booking)6 JacksonJsonProvider (com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 WebClient (org.apache.cxf.jaxrs.client.WebClient)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 Client (javax.ws.rs.client.Client)2 WebTarget (javax.ws.rs.client.WebTarget)2 Attachment (org.apache.cxf.jaxrs.ext.multipart.Attachment)2 LinkedList (java.util.LinkedList)1 GenericType (javax.ws.rs.core.GenericType)1 MultipartBody (org.apache.cxf.jaxrs.ext.multipart.MultipartBody)1