本文整理了Java中org.apache.cxf.jaxrs.client.WebClient.getCollection()
方法的一些代码示例,展示了WebClient.getCollection()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebClient.getCollection()
方法的具体详情如下:
包路径:org.apache.cxf.jaxrs.client.WebClient
类名称:WebClient
方法名:getCollection
[英]Does HTTP GET invocation and returns a collection of typed objects
[中]HTTP是否获取调用并返回类型化对象的集合
代码示例来源:origin: stackoverflow.com
List<Object> providers = new ArrayList<Object>();
providers.add( new JacksonJaxbJsonProvider() );
WebClient client=WebClient.create("http://localhost:6969/CXF3/rest",providers);
client = client.accept("application/json").type("application/json").path("/service/getAll");
Collection<? extends Person> order=client.getCollection(Person.class);
for(Person p:order){
System.out.println(p.getEname()+" "+p.getEmpid()+" "+p.getEsal());
}
代码示例来源:origin: com.tomitribe.tribestream/tribestream-container
@Override
public List<GroupPrincipal> loadRoles(final List<UserPrincipal> principals) {
final WebClient client = createClient();
final List<GroupPrincipal> result = new ArrayList<GroupPrincipal>();
for (final String s : client.getCollection(String.class)) {
result.add(new GroupPrincipal(s));
}
return result;
}
代码示例来源:origin: Talend/tesb-rt-se
private void getAllMembers(WebClient webClient) {
System.out.println("Retrieving list of all members:");
List<Person> persons = new ArrayList<Person>(webClient.getCollection(Person.class));
for (Person person : persons) {
System.out
.println("ID " + person.getId() + ": " + person.getName() + ", age: " + person.getAge());
}
}
代码示例来源:origin: apache/karaf
@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;
}
代码示例来源:origin: apache/cxf
@Test
public void testGetCollectionOfBooks() throws Exception {
String endpointAddress =
"http://localhost:" + PORT + "/webapp/store1/bookstore/collections";
WebClient wc = WebClient.create(endpointAddress,
Collections.singletonList(new JacksonJsonProvider()));
wc.accept("application/json");
Collection<? extends Book> collection = wc.getCollection(Book.class);
assertEquals(1, collection.size());
Book book = collection.iterator().next();
assertEquals(123L, book.getId());
}
代码示例来源:origin: apache/cxf
@Test
public void testGetCollectionOfBooks() throws Exception {
String endpointAddress =
"http://localhost:" + PORT + "/bookstore/collections";
WebClient wc = WebClient.create(endpointAddress);
wc.accept("application/xml");
Collection<? extends Book> collection = wc.getCollection(Book.class);
assertEquals(1, collection.size());
Book book = collection.iterator().next();
assertEquals(123L, book.getId());
}
代码示例来源:origin: apache/cxf
@Test
public void testGetCollectionOfSuperBooks() throws Exception {
String endpointAddress =
"http://localhost:" + PORT + "/webapp/store2/books/superbooks";
WebClient wc = WebClient.create(endpointAddress,
Collections.singletonList(new JacksonJsonProvider()));
wc.accept("application/json");
Collection<? extends Book> collection = wc.getCollection(Book.class);
assertEquals(1, collection.size());
Book book = collection.iterator().next();
assertEquals(999L, book.getId());
}
代码示例来源:origin: Talend/tesb-rt-se
Collection<? extends PersonInfo> personInfos = wc.getCollection(PersonInfo.class);
for (PersonInfo pi : personInfos) {
System.out.println("ID : " + pi.getId());
内容来源于网络,如有侵权,请联系作者删除!